Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(agent-contract): A2 registry docs + gbrain errors + B9 scanner
garrytan2716d9a87757
diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdnew file mode 100644index 0000000000..ef2fc3136b--- /dev/null+++ b/docs/guides/error-codes.md@@ -0,0 +1,1945 @@+<!-- GENERATED by `bun run build:error-codes` from src/core/error-registry.ts. Do not edit by hand. -->+# Error codes++Every gbrain error carries a stable `code`. Read `code` first and fall back to `error`+(older servers send only `error`); then follow `fix.next` as described in+[AGENT_OPERATOR_v1](../protocol/AGENT_OPERATOR_v1.md). Exit codes are in [exit codes](exit-codes.md).+Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the renamed codes.++**Say to your agent:** *"gbrain returned an error code I don't recognize. Look it up and tell me what to do."*++## Renamed in this release++Under contract v1 an existing `error` value never changes. Where a surface historically sent a+different value, it keeps sending it in `error` and adds the canonical value in `code`.++| `error` (frozen) | `code` (canonical) | Meaning |+|---|---|---|+| `permission_denied` | `insufficient_scope` | The connection lacks the OAuth scope the operation requires. |+| `invalid_params` | `not_found` | The requested resource does not exist or is not visible to this caller. |+| `page_identity_changed` | `page_not_found` | No page with that slug exists in the selected source. |+| `unknown_operation` | `unknown_tool` | The named tool does not exist or is not callable on this connection. |++## Codes++### access_command_failed++<a id="access_command_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: access command failed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### access_denied_test_user++<a id="access_denied_test_user"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: access denied test user. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### access_env_missing++<a id="access_env_missing"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: access env missing. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### acknowledgment_unavailable++<a id="acknowledgment_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This batch is unknown or outside the retained replay window. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### admin_policy_enforced++<a id="admin_policy_enforced"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: admin policy enforced. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### ambiguous_id++<a id="ambiguous_id"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The legacy id matches multiple readable pages. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### ambiguous_skill++<a id="ambiguous_skill"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This name belongs to multiple authorized sources. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### api_not_enabled++<a id="api_not_enabled"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: api not enabled. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### approval_required++<a id="approval_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The change needs the owner's explicit approval before it can proceed. | The step needs the user's decision before it runs. | Stop and ask the user; re-run only with the authorization the message names. | user | `repeat the read that failed` | 1 | no |++### autopilot_job_owned_by_other_brain++<a id="autopilot_job_owned_by_other_brain"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The autopilot job is bound to a different brain. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_duplicate_task_id++<a id="benchmark_duplicate_task_id"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark duplicate task id. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_empty++<a id="benchmark_empty"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The benchmark file has no tasks. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_exists++<a id="benchmark_exists"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A benchmark already exists at the target path. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_judge_llm_no_rubric++<a id="benchmark_judge_llm_no_rubric"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark judge llm no rubric. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_judge_qrels_no_expected++<a id="benchmark_judge_qrels_no_expected"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark judge qrels no expected. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_judge_rule_no_checks++<a id="benchmark_judge_rule_no_checks"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark judge rule no checks. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_judge_unknown_kind++<a id="benchmark_judge_unknown_kind"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark judge unknown kind. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_malformed++<a id="benchmark_malformed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A benchmark row is not valid JSON. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_missing_judge++<a id="benchmark_missing_judge"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark missing judge. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_missing_task++<a id="benchmark_missing_task"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark missing task. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_missing_task_id++<a id="benchmark_missing_task_id"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark missing task id. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_not_found++<a id="benchmark_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The benchmark file cannot be read. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_rule_check_bad_arg++<a id="benchmark_rule_check_bad_arg"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark rule check bad arg. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_rule_check_malformed++<a id="benchmark_rule_check_malformed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark rule check malformed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### benchmark_rule_check_unknown_op++<a id="benchmark_rule_check_unknown_op"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Benchmark rule check unknown op. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### bootstrap_empty++<a id="bootstrap_empty"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The benchmark bootstrap produced no tasks. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### bootstrap_pending_review++<a id="bootstrap_pending_review"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The bootstrapped benchmark awaits human review. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### bridge_ownership_conflict++<a id="bridge_ownership_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The private local CLI registration is invalid. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### bucket_not_found++<a id="bucket_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The configured storage bucket does not exist. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### budget_unsatisfiable++<a id="budget_unsatisfiable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Reserved by MEMORY_VERBS v1; never returned. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### cancelled++<a id="cancelled"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The write was cancelled before it committed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### catalog_unavailable++<a id="catalog_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Shared skill storage is not ready on this brain. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### checkpoint_missing++<a id="checkpoint_missing"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The approved source plan is missing; do not restart from a different revision. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### checkpoint_validation_timeout++<a id="checkpoint_validation_timeout"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Validating the managed-sync checkpoint timed out. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### claim_already_used++<a id="claim_already_used"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: claim already used. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### client_json_unreadable++<a id="client_json_unreadable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: client json unreadable. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### client_json_wrong_type++<a id="client_json_wrong_type"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: client json wrong type. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### client_shape_invalid++<a id="client_shape_invalid"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: client shape invalid. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### code_callees_requires_symbol++<a id="code_callees_requires_symbol"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| code-callees requires a symbol name. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### code_callers_requires_symbol++<a id="code_callers_requires_symbol"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| code-callers requires a symbol name. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### code_def_requires_symbol++<a id="code_def_requires_symbol"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| code-def requires a symbol name. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### code_refs_requires_symbol++<a id="code_refs_requires_symbol"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| code-refs requires a symbol name. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### code_reused++<a id="code_reused"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: code reused. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### colon_slug_windows_write_through++<a id="colon_slug_windows_write_through"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A colon slug cannot be written through on Windows. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#colon_slug_windows_write_through](../../docs/guides/write-refusals.md#colon_slug_windows_write_through)++### command_failed++<a id="command_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The command failed before it wrote its JSON result. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### config_error++<a id="config_error"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A required configuration value or directory is missing or invalid. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### confirmation_required++<a id="confirmation_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The command needs the user's authorization before it runs; nothing was changed. | The step needs the user's decision before it runs. | Stop and ask the user; re-run only with the authorization the message names. | user | `repeat the read that failed` | 3 | no |++### conflicting_source_scope++<a id="conflicting_source_scope"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| --source and --all-sources were both given. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### connector_account_changed++<a id="connector_account_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The connector credential resolves to a different account than the source is pinned to. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### connector_fence_below_timeline++<a id="connector_fence_below_timeline"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A stored page carries a fence the connector render cannot preserve. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### connector_holds_exhausted++<a id="connector_holds_exhausted"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source holds the maximum number of failed items; its cursor did not advance. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### connector_intent_outdated++<a id="connector_intent_outdated"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The connector request no longer matches the stored connector intent. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### consent_timeout++<a id="consent_timeout"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: consent timeout. | The step needs the user's decision before it runs. | Stop and ask the user; re-run only with the authorization the message names. | user | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### cost_cap_exceeded++<a id="cost_cap_exceeded"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The run reached its cost cap before finishing. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### cost_preview_requires_yes++<a id="cost_preview_requires_yes"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Cost preview requires yes. | The step needs the user's decision before it runs. | Stop and ask the user; re-run only with the authorization the message names. | user | `repeat the read that failed` | 1 | no |++### d_sel_too_small++<a id="d_sel_too_small"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The selection split has too few tasks for meaningful validation. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### database_error++<a id="database_error"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The brain database could not be reached or refused the operation. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### demo_graph_failed++<a id="demo_graph_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The fictional graph did not verify. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### demo_import_failed++<a id="demo_import_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The fictional page did not import successfully. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### demo_verification_failed++<a id="demo_verification_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Expected ownership or decision provenance is missing. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### derived_cap_exhausted++<a id="derived_cap_exhausted"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Paid work stopped at the cost cap derived from its estimate; the run is resumable. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### destination_not_ready++<a id="destination_not_ready"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The destination brain is not initialized for this operation. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### dirty_tree++<a id="dirty_tree"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Commit or stash canonical skill edits before optimization. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### effect_not_failed++<a id="effect_not_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Only a failed, non-running embedding effect can be explicitly retried. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### embedding_auth_failed++<a id="embedding_auth_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The embedding provider rejected the credentials. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++More: [docs/guides/write-refusals.md#embedding_auth_failed](../../docs/guides/write-refusals.md#embedding_auth_failed)++### embedding_budget_below_worst_case++<a id="embedding_budget_below_worst_case"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The embedding migration cap is below its worst-case cost; nothing was changed. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### embedding_configuration++<a id="embedding_configuration"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The brain's embedding configuration is invalid. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### embedding_disabled++<a id="embedding_disabled"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Embeddings are disabled on this brain. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### embedding_failed++<a id="embedding_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Computing embeddings for the content failed. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### embedding_model_mismatch++<a id="embedding_model_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The configured provider does not match the active embedding column. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### embedding_plane_split++<a id="embedding_plane_split"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Embedding plane split. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### embedding_storage_unavailable++<a id="embedding_storage_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Embedding policy or claim storage is temporarily unavailable. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### embedding_unavailable++<a id="embedding_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The provider returned an incomplete embedding batch. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### embedding_unconfigured++<a id="embedding_unconfigured"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The selected brain has no verifiable text embedding model and dimensions. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### export_limit++<a id="export_limit"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This migration is bounded to 5,000 active pages per source; split or use a reviewed bulk export. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### extraction_failed++<a id="extraction_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The accepted atom extraction produced malformed output. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### extractor_identity_mismatch++<a id="extractor_identity_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The approved extractor differs from the installed extractor; this receipt cannot resume or admit another revision. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### fact_already_expired++<a id="fact_already_expired"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The fact had already expired before this write. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### fact_not_found++<a id="fact_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Fact not found. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### facts_absorb_write_refused++<a id="facts_absorb_write_refused"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Facts absorb refused the write. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#facts_absorb_write_refused](../../docs/guides/write-refusals.md#facts_absorb_write_refused)++### facts_payload_expired++<a id="facts_payload_expired"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The accepted fact extraction failed and its retained payload has expired. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### fetch_failed++<a id="fetch_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Fetching the upstream failed. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/write-refusals.md#fetch_failed](../../docs/guides/write-refusals.md#fetch_failed)++### full_resync_required++<a id="full_resync_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The catalog cursor is invalid or expired. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### git_index_locked++<a id="git_index_locked"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Another Git process holds the canonical checkout index lock. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### git_index_stale++<a id="git_index_stale"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Git index stale. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### git_push_unavailable++<a id="git_push_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The canonical commit is durable locally; its push will retry. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### git_target_unsafe++<a id="git_target_unsafe"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Git cannot identify the existing canonical file by its native spelling. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### git_unavailable++<a id="git_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A git command did not complete. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### graph_incomplete++<a id="graph_incomplete"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Source relationship reconciliation is incomplete. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### held_out_overlaps_benchmark++<a id="held_out_overlaps_benchmark"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Held out overlaps benchmark. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### held_out_required_for_bundled++<a id="held_out_required_for_bundled"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Held out required for bundled. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### idempotency_conflict++<a id="idempotency_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The request_id already belongs to a different accepted operation. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### independent_principal_required++<a id="independent_principal_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This local CLI principal already owns another source/destination for this harness. | The step needs the user's decision before it runs. | Stop and ask the user; re-run only with the authorization the message names. | user | `repeat the read that failed` | 1 | no |++### insufficient_scope++<a id="insufficient_scope"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The connection lacks the OAuth scope the operation requires. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### internal++<a id="internal"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A memory verb failed on the server; this is not a caller mistake. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### internal_error++<a id="internal_error"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The server failed while running the operation; this is not a caller mistake. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### interrupted++<a id="interrupted"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The operation was interrupted by a signal before it finished. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 130 | no |++### invalid_client++<a id="invalid_client"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: invalid client. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### invalid_connector_text++<a id="invalid_connector_text"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Invalid connector text. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### invalid_grant_clock_skew++<a id="invalid_grant_clock_skew"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: invalid grant clock skew. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### invalid_grant_revoked++<a id="invalid_grant_revoked"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: invalid grant revoked. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### invalid_grant_testing_expiry++<a id="invalid_grant_testing_expiry"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: invalid grant testing expiry. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### invalid_params++<a id="invalid_params"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A parameter is missing, has the wrong type, or has an invalid value. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 2 | no |++### invalid_request++<a id="invalid_request"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| submit_agent over the local CLI: use `gbrain agent run` instead. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### invalid_source++<a id="invalid_source"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source argument or source state is invalid for this operation. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### invalid_source_pin++<a id="invalid_source_pin"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The .gbrain-source pin names an invalid source id. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### invalid_source_uri++<a id="invalid_source_uri"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The page has a stored file source_uri that cannot be resolved to a local filesystem path. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### invalid_token++<a id="invalid_token"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The bearer token is missing, invalid, or revoked. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### invalid_write_wait++<a id="invalid_write_wait"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Invalid write wait. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### legacy_job_selection_invalid++<a id="legacy_job_selection_invalid"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The legacy job selection is invalid. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/repair.md#legacy-job-selection-invalid](../../docs/guides/repair.md#legacy-job-selection-invalid)++### legacy_jobs_active++<a id="legacy_jobs_active"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Legacy jobs are still active. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/repair.md#legacy-jobs-active](../../docs/guides/repair.md#legacy-jobs-active)++### local_conflict++<a id="local_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A local file or registration conflicts with the requested change. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### lock_busy++<a id="lock_busy"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Another process holds the lock this command needs. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### managed_pull_skipped++<a id="managed_pull_skipped"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The managed pull was skipped. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/write-refusals.md#managed_pull_skipped](../../docs/guides/write-refusals.md#managed_pull_skipped)++### method_not_allowed++<a id="method_not_allowed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The HTTP method is not allowed on this endpoint. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### missing_source_scope++<a id="missing_source_scope"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A remote tool call reached dispatch without a resolved source scope; the shared default source is refused. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### missing_source_value++<a id="missing_source_value"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A source flag was given without a value. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### models_strict_violation++<a id="models_strict_violation"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A configured model is not allowed under models strict mode. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### no_pricing++<a id="no_pricing"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| gbrain has no price for the model, so a user-set cost cap cannot be enforced. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++More: [docs/guides/write-refusals.md#no_pricing](../../docs/guides/write-refusals.md#no_pricing)++### no_refresh_token++<a id="no_refresh_token"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: no refresh token. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### no_routing_eval++<a id="no_routing_eval"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The skill has no routing-eval rows to bootstrap a benchmark from. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### no_skill_md++<a id="no_skill_md"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The skill directory has no SKILL.md. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### no_worker_surface++<a id="no_worker_surface"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| No worker surface. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### not_a_git_repo++<a id="not_a_git_repo"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source path must contain committed Git content. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### not_connected++<a id="not_connected"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: not connected. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### not_found++<a id="not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The requested resource does not exist or is not visible to this caller. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### overlapping_path++<a id="overlapping_path"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Sources cannot claim overlapping canonical directories. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### owner_unavailable++<a id="owner_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The brain's persistence owner is not reachable right now. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### page_identity_changed++<a id="page_identity_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The page was deleted or replaced while the operation ran. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### page_not_found++<a id="page_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| No page with that slug exists in the selected source. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### parse_error++<a id="parse_error"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The request body is not valid JSON. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### pasted_wrong_url++<a id="pasted_wrong_url"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: pasted wrong url. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### payload_too_large++<a id="payload_too_large"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The payload exceeds the configured size cap. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### pending_writes++<a id="pending_writes"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A pending source write prevents verified completion. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### permission_denied++<a id="permission_denied"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This caller is not authorized for the operation. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### plan_output_failed++<a id="plan_output_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writing the plan output failed. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### plan_stale++<a id="plan_stale"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The saved plan has no valid repository identity. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### port_in_use++<a id="port_in_use"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: port in use. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### preview_changed++<a id="preview_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The state changed since the approved preview. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/repair.md#preview-changed](../../docs/guides/repair.md#preview-changed)++### profile_incompatible++<a id="profile_incompatible"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The stored profile is incompatible with this operation. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### projection_owner_resident++<a id="projection_owner_resident"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A resident owner holds the projection. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/repair.md#projection-owner-resident](../../docs/guides/repair.md#projection-owner-resident)++### projection_pending++<a id="projection_pending"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The current text projection is not ready. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### provenance_required++<a id="provenance_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| provenance is required and must be non-empty. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### publication_pending++<a id="publication_pending"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The catalog adoption is accepted but not fully committed. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### queue_capacity++<a id="queue_capacity"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The bounded queue is full; existing requests keep their place. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### rate_limited++<a id="rate_limited"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The request was rate-limited; retry after the stated delay. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### recovery_required++<a id="recovery_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| An earlier write left state that must be inspected and recovered before new writes. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### redirect_uri_mismatch++<a id="redirect_uri_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: redirect uri mismatch. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### refresh_dirty++<a id="refresh_dirty"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The worktree has uncommitted changes. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_dirty](../../docs/guides/write-refusals.md#refresh_dirty)++### refresh_diverged++<a id="refresh_diverged"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The worktree diverged from its upstream; a fast-forward is impossible. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_diverged](../../docs/guides/write-refusals.md#refresh_diverged)++### refresh_drain_timeout++<a id="refresh_drain_timeout"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| In-flight work did not drain before the refresh deadline. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/write-refusals.md#refresh_drain_timeout](../../docs/guides/write-refusals.md#refresh_drain_timeout)++### refresh_no_upstream++<a id="refresh_no_upstream"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The worktree has no upstream to refresh from. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_no_upstream](../../docs/guides/write-refusals.md#refresh_no_upstream)++### refresh_not_managed++<a id="refresh_not_managed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source is not managed, so it cannot be refreshed. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_not_managed](../../docs/guides/write-refusals.md#refresh_not_managed)++### refresh_not_owner++<a id="refresh_not_owner"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This process does not own the worktree it would refresh. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_not_owner](../../docs/guides/write-refusals.md#refresh_not_owner)++### refresh_source_changed++<a id="refresh_source_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source changed during the refresh. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/write-refusals.md#refresh_source_changed](../../docs/guides/write-refusals.md#refresh_source_changed)++### relay_disabled++<a id="relay_disabled"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: relay disabled. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### relay_session_expired++<a id="relay_session_expired"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: relay session expired. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### relay_unreachable++<a id="relay_unreachable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: relay unreachable. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### request_already_submitted++<a id="request_already_submitted"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This optimizer publication request has already been submitted. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### request_too_large++<a id="request_too_large"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The request exceeds a configured capacity; narrow it. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### requirements_changed++<a id="requirements_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The runtime requirements exceed the owner-approved publication policy. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### response_too_large++<a id="response_too_large"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Persistence response exceeds the local transport limit. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### resume_spec_mismatch++<a id="resume_spec_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Resume spec mismatch. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### revision_conflict++<a id="revision_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The target changed since it was read; the expected revision no longer matches. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### revision_required++<a id="revision_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Review the current policy and supply its expected_policy_epoch before changing disclosure. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### revision_unavailable++<a id="revision_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The exact authorized revision is unavailable. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### scope_denied++<a id="scope_denied"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The connection lacks the scope this memory verb requires. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### scope_missing++<a id="scope_missing"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: scope missing. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### shared_skills_unavailable++<a id="shared_skills_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The shared-skills operation was refused. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### shared_skills_unsupported++<a id="shared_skills_unsupported"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The server does not expose the shared-skills protocol. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### skill_asset_not_found++<a id="skill_asset_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The requested file is not in the approved revision manifest. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### skill_bundle_required++<a id="skill_bundle_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Import cannot publish skill paths. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### skill_candidate_invalid++<a id="skill_candidate_invalid"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The optimized candidate changed protected frontmatter or has an empty/invalid body. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### skill_not_found++<a id="skill_not_found"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| No authorized published skill matches this key. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### skill_retention_capacity++<a id="skill_retention_capacity"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Retained skill revisions exceed this source storage budget. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_binding_required++<a id="source_binding_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A write needs an explicit source binding on this MCP server (--source-guard). | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_changed++<a id="source_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source changed during the operation; nothing was committed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_id_taken++<a id="source_id_taken"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This source already exists and does not match this exact admitted request. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_not_ready++<a id="source_not_ready"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A committed source and approved schema are required. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_profile_no_backfill++<a id="source_profile_no_backfill"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This source profile disables automatic embedding backfill. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### source_referenced++<a id="source_referenced"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| OAuth clients still reference this source. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_root_conflict++<a id="source_root_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Multiple active sources alias this canonical skill root; resolve ownership before publishing. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### source_writeback_required++<a id="source_writeback_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Canonical preparation requires a source-content correction; this profile never writes repository files. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### split_bad_ratio++<a id="split_bad_ratio"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Split bad ratio. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### split_unparseable++<a id="split_unparseable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Split unparseable. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### state_mismatch++<a id="state_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: state mismatch. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### storage_error++<a id="storage_error"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Reading or writing durable storage failed. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### sync_in_progress++<a id="sync_in_progress"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A sync is running on this source. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/write-refusals.md#sync_in_progress](../../docs/guides/write-refusals.md#sync_in_progress)++### take_row_collision++<a id="take_row_collision"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A takes fence row number is already used by a different take that is not in this page's canonical fence. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### target_escape++<a id="target_escape"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The skill target must remain within its selected root. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### timeout++<a id="timeout"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The operation did not finish within its time bound. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 124 | yes |++### topology_change_required++<a id="topology_change_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Adding this source would replace or overlap another owner root. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### unavailable++<a id="unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A required dependency or capability cannot serve this request. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### unexpected_file_bytes++<a id="unexpected_file_bytes"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| A canonical skill file mode changed outside publication. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### unexpected_staging_bytes++<a id="unexpected_staging_bytes"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Recovery staging has unexpected bytes or identity; the root and its recovery capacity remain reserved. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### unknown++<a id="unknown"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| An unclassified failure (legacy StructuredError fallback code). | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### unknown_flag++<a id="unknown_flag"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The command does not accept one of the flags passed. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 2 | no |++### unknown_method++<a id="unknown_method"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The JSON-RPC method is not supported. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### unknown_source++<a id="unknown_source"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The named source is not registered or is archived. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### unknown_tool++<a id="unknown_tool"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The named tool does not exist or is not callable on this connection. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### unknown_transport++<a id="unknown_transport"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The caller's transport could not be identified. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### unmanaged_path++<a id="unmanaged_path"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Reclone only replaces a checkout created and managed by GBrain. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### unsupported_export_data++<a id="unsupported_export_data"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The source contains data this export path cannot carry. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### unsupported_mutation_protocol++<a id="unsupported_mutation_protocol"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Prepared mutation does not match its accepted target. | A capability this request needs is not configured or not reachable on this brain. | A required capability is not available on this brain. Run `gbrain doctor --json` to see what is missing. | agent | `gbrain doctor --json` | 1 | no |++### upstream++<a id="upstream"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: upstream. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)++### verification_failed++<a id="verification_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Source content or relationships changed during verification. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### withdrawal_capacity++<a id="withdrawal_capacity"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Withdrawal capacity. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### withdrawal_provenance++<a id="withdrawal_provenance"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The withdrawal target manifest is invalid. | The server failed; this is not a caller mistake. | Server-side failure, not a caller mistake. Run `gbrain doctor --json` on the brain host; if it repeats, report it to the user. | host_admin | `gbrain doctor --json` | 1 | no |++### write_claim_lost++<a id="write_claim_lost"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Execution claim changed before publication. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### write_pending++<a id="write_pending"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The write was accepted and is still pending; it may commit later. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 10 | yes |++### writer_admin_intent_required++<a id="writer_admin_intent_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Topology changes require an action-specific --admin-intent and the --expected-state from a reviewed writer status. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_admin_locked++<a id="writer_admin_locked"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writer administration is locked; deactivation was not applied. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_admin_state_changed++<a id="writer_admin_state_changed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writer topology changed since inspection; the administrative request was not applied. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### writer_busy++<a id="writer_busy"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The canonical worktree is busy with another write. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### writer_coordinator_required++<a id="writer_coordinator_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The operation needs managed persistence (a writer coordinator) on the brain host. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_identity_invalid++<a id="writer_identity_invalid"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The local writer identity is invalid. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_identity_publish_failed++<a id="writer_identity_publish_failed"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| The replacement writer is durable but its credential file could not be published. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_lock_unavailable++<a id="writer_lock_unavailable"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Another activation probe is running. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### writer_manifest_mismatch++<a id="writer_manifest_mismatch"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Successor checkout differs from the recorded canonical manifest. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### writer_manifest_unsafe++<a id="writer_manifest_unsafe"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Canonical worktree transfer requires a symlink-free manifest. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### writer_not_initialized++<a id="writer_not_initialized"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Persistence identity is missing. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_not_quiesced++<a id="writer_not_quiesced"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Older writers or maintenance jobs are still running. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_pool_capacity++<a id="writer_pool_capacity"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Mirror recovery is waiting for publication capacity. | A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later. | Wait briefly, then retry the same request (writes: reuse the same request_id). | agent | `repeat the read that failed` | 1 | yes |++### writer_registration_required++<a id="writer_registration_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writer registration required. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_regrant_required++<a id="writer_regrant_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| This lane already has a different grant. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### writer_transfer_conflict++<a id="writer_transfer_conflict"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writer transfer conflict. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### writer_transfer_required++<a id="writer_transfer_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Writer transfer required. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++### writer_upgrade_required++<a id="writer_upgrade_required"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Apply the canonical writer guard, outbox, and source lifecycle migrations before activation. | Only the operator of the brain host can change what blocks this. | Only the brain host's operator can resolve this. Tell the user the message and run `gbrain doctor --json` on the brain host. | host_admin | `gbrain doctor --json` | 1 | no |++### wrong_account_consented++<a id="wrong_account_consented"></a>++| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |+|---|---|---|---|---|---|---|+| Google connect credential error: wrong account consented. | The request itself was wrong or no longer matches the brain; nothing was changed. | Correct the request using the message above, then retry. | agent | `repeat the read that failed` | 1 | no |++More: [docs/guides/google-connect.md#troubleshooting](../../docs/guides/google-connect.md#troubleshooting)diff --git a/package.json b/package.jsonindex 682c56ce12..534a31fbda 100644--- a/package.json+++ b/package.json@@ -130,6 +130,9 @@"check:skill-refs": "bun scripts/check-skill-refs.mjs","gate:skills": "bash scripts/skills-commit-gate.sh","check:guard-self-test": "bash scripts/guard-self-test.sh",+ "build:error-codes": "bun scripts/build-error-codes.ts",+ "check:error-codes": "bun scripts/build-error-codes.ts --check",+ "check:agent-contract": "bun scripts/check-agent-contract.ts","check:no-legacy-getconnection": "bash scripts/check-no-legacy-getconnection.sh","check:module-size": "bash scripts/check-module-size.sh","check:function-size": "bun scripts/check-function-size.ts",diff --git a/scripts/agent-contract-baselines/hand-built-command.tsv b/scripts/agent-contract-baselines/hand-built-command.tsvnew file mode 100644index 0000000000..213f0b804e--- /dev/null+++ b/scripts/agent-contract-baselines/hand-built-command.tsv@@ -0,0 +1,15 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule hand-built-command: path<TAB>count+src/commands/doctor/checks/auto-chronicle.ts 1+src/commands/doctor/checks/vector-coverage.ts 2+src/commands/models.ts 1+src/commands/serve-http-grants.ts 1+src/core/ai/decide/outcomes.ts 20+src/core/creds/errors.ts 16+src/core/facts/relink-reasons.ts 3+src/core/grants/legacy-token.ts 1+src/core/harness/verify.ts 1+src/core/onboard/checks.ts 1+src/core/persistence/effect-retry.ts 1+src/core/persistence/page-input.ts 1+src/core/search/modes-report.ts 1+src/mcp/capabilities.ts 1diff --git a/scripts/agent-contract-baselines/interactive-io.tsv b/scripts/agent-contract-baselines/interactive-io.tsvnew file mode 100644index 0000000000..c9cda0130c--- /dev/null+++ b/scripts/agent-contract-baselines/interactive-io.tsv@@ -0,0 +1,19 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule interactive-io: path<TAB>count+src/commands/book-mirror.ts 1+src/commands/capture.ts 1+src/commands/company-brain-connect.ts 1+src/commands/connectors/auth.ts 1+src/commands/dream-retriage.ts 1+src/commands/hook.ts 3+src/commands/init.ts 4+src/commands/jobs-watch.ts 2+src/commands/migrate-embeddings.ts 2+src/commands/notability-eval.ts 1+src/commands/reindex-frontmatter.ts 1+src/commands/reindex-search-vector.ts 1+src/commands/report.ts 1+src/commands/upgrade.ts 1+src/commands/watch.ts 1+src/core/post-upgrade-reembed.ts 1+src/core/skillpack/trust-prompt.ts 1+src/mcp/server.ts 2diff --git a/scripts/agent-contract-baselines/legacy-advice-key.tsv b/scripts/agent-contract-baselines/legacy-advice-key.tsvnew file mode 100644index 0000000000..36a85b8b50--- /dev/null+++ b/scripts/agent-contract-baselines/legacy-advice-key.tsv@@ -0,0 +1,83 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule legacy-advice-key: path<TAB>count+src/cli.ts 1+src/commands/autopilot/jobs.ts 2+src/commands/claw-test.ts 11+src/commands/code-callees.ts 1+src/commands/code-callers.ts 1+src/commands/code-def.ts 2+src/commands/code-refs.ts 2+src/commands/code-scope.ts 5+src/commands/company-brain-connect.ts 2+src/commands/creds.ts 1+src/commands/doctor/checks/data-integrity.ts 1+src/commands/doctor/checks/sync-failures.ts 1+src/commands/engine-status.ts 1+src/commands/friction.ts 1+src/commands/google-attachments.ts 1+src/commands/google-setup-tail.ts 1+src/commands/google.ts 5+src/commands/harness-connect.ts 1+src/commands/hook.ts 2+src/commands/loops.ts 1+src/commands/mcp-admin.ts 2+src/commands/mcp.ts 2+src/commands/reindex-code.ts 1+src/commands/reindex-search-vector.ts 1+src/commands/serve-http-clients.ts 1+src/commands/serve-http-grants.ts 2+src/commands/serve-http-oauth.ts 1+src/commands/serve-http-registration.ts 1+src/commands/serve-http-webhooks.ts 4+src/commands/skillpack.ts 1+src/commands/sources-retry-held.ts 3+src/commands/upgrade.ts 7+src/core/agent-install/entry.ts 1+src/core/agent-install/shared-skills.ts 7+src/core/ai/recipes/llama-server.ts 2+src/core/ai/recipes/lmstudio.ts 2+src/core/backup/coverage.ts 11+src/core/backup/repository.ts 1+src/core/brainstorm/error-classify.ts 1+src/core/connectors/sync.ts 8+src/core/context/hook-heartbeat.ts 2+src/core/cycle.ts 1+src/core/cycle/patterns.ts 1+src/core/cycle/synthesize.ts 1+src/core/error-catalogue.ts 2+src/core/error-docs.ts 1+src/core/friction.ts 1+src/core/harness/capabilities.ts 1+src/core/harness/install.ts 4+src/core/harness/shared-skills.ts 3+src/core/harness/status.ts 2+src/core/harness/verify.ts 1+src/core/ops/code-intel.ts 2+src/core/ops/facts.ts 2+src/core/ops/search.ts 1+src/core/output/post-write.ts 1+src/core/persistence/diagnostics.ts 2+src/core/persistence/effect-retry.ts 7+src/core/persistence/health.ts 1+src/core/persistence/memory-prepare.ts 1+src/core/persistence/onboarding.ts 1+src/core/persistence/page-advisories.ts 1+src/core/persistence/params.ts 1+src/core/persistence/types.ts 1+src/core/pg-access-classify.ts 18+src/core/schema-pack/lint-rules.ts 16+src/core/search/projection-readiness.ts 2+src/core/shared-skills/adapter.ts 1+src/core/shared-skills/migration-members.ts 1+src/core/skillopt/benchmark.ts 20+src/core/skillopt/bootstrap-benchmark.ts 5+src/core/skillopt/bundled-skill-gate.ts 1+src/core/skillopt/checkpoint.ts 1+src/core/skillopt/cycle-phase.ts 2+src/core/skillopt/lock.ts 1+src/core/skillopt/models-plan.ts 1+src/core/skillopt/orchestrator.ts 6+src/core/skillpack/preconditions.ts 9+src/core/skillpack/shared-brain-bridge.ts 7+src/core/sync-cost-gate.ts 3+src/core/verbs.ts 1+src/mcp/capabilities.ts 1diff --git a/scripts/agent-contract-baselines/marker-literal.tsv b/scripts/agent-contract-baselines/marker-literal.tsvnew file mode 100644index 0000000000..5c93fe99e4--- /dev/null+++ b/scripts/agent-contract-baselines/marker-literal.tsv@@ -0,0 +1,10 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule marker-literal: path<TAB>count+src/commands/config.ts 1+src/commands/doctor/upgrade-banner.ts 6+src/commands/google-attachments.ts 1+src/commands/google.ts 4+src/commands/init-mode-picker.ts 6+src/commands/upgrade.ts 5+src/core/advisor/render.ts 2+src/core/onboard/writeback-nudge.ts 5+src/core/skillpack/brain-pack-advisory.ts 1diff --git a/scripts/agent-contract-baselines/stdio-inherit.tsv b/scripts/agent-contract-baselines/stdio-inherit.tsvnew file mode 100644index 0000000000..f7b24fc2c6--- /dev/null+++ b/scripts/agent-contract-baselines/stdio-inherit.tsv@@ -0,0 +1,11 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule stdio-inherit: path<TAB>count+src/cli/commands/smoke-test.ts 1+src/commands/advisor.ts 1+src/commands/autopilot.ts 1+src/commands/migrations/v0_11_0.ts 2+src/commands/skillopt.ts 1+src/commands/takes.ts 1+src/commands/upgrade.ts 6+src/core/cli-options.ts 1+src/core/minions/child-worker-supervisor.ts 1+src/core/thin-client-upgrade-prompt.ts 1diff --git a/scripts/agent-contract-baselines/suggestionless-operation-error.tsv b/scripts/agent-contract-baselines/suggestionless-operation-error.tsvnew file mode 100644index 0000000000..108622e556--- /dev/null+++ b/scripts/agent-contract-baselines/suggestionless-operation-error.tsv@@ -0,0 +1,166 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule suggestionless-operation-error: path<TAB>count+src/cli.ts 3+src/commands/book-mirror.ts 1+src/commands/capture.ts 4+src/commands/company-brain-connect.ts 15+src/commands/company-brain-inspect.ts 8+src/commands/embed-facts-delegate.ts 5+src/commands/extract-stale-delegate.ts 4+src/commands/extract-timeline-db.ts 2+src/commands/google-attachments.ts 11+src/commands/persistence-admin.ts 11+src/commands/recall.ts 3+src/commands/reindex-code-delegate.ts 6+src/commands/repair.ts 6+src/commands/source-reconcile.ts 29+src/commands/sources-lifecycle-args.ts 1+src/commands/sources-lifecycle.ts 2+src/commands/sync-persistence-delegate.ts 4+src/commands/takes-mutation.ts 1+src/core/company-brain/admission.ts 20+src/core/company-brain/demo.ts 5+src/core/company-brain/inspection.ts 8+src/core/company-brain/policy.ts 2+src/core/company-brain/profile.ts 7+src/core/company-brain/receipts.ts 1+src/core/company-brain/revision.ts 21+src/core/company-brain/runtime.ts 16+src/core/cycle/phantom-redirect-managed.ts 3+src/core/cycle/synthesize-postprocess.ts 4+src/core/embed-backfill-submit.ts 1+src/core/embed-facts-options.ts 1+src/core/embed-facts.ts 2+src/core/facts/backstop.ts 1+src/core/facts/proposal-supersede.ts 4+src/core/facts/relink-publish.ts 8+src/core/google/attachment-backfill.ts 7+src/core/harness/native-router.ts 1+src/core/harness/shared-skills.ts 2+src/core/minions/submission-authority.ts 1+src/core/minions/tool-write-identity.ts 1+src/core/ops/attribution.ts 1+src/core/ops/code-intel.ts 1+src/core/ops/connectors.ts 3+src/core/ops/context.ts 20+src/core/ops/extraction.ts 2+src/core/ops/facts.ts 1+src/core/ops/files.ts 3+src/core/ops/insights.ts 1+src/core/ops/jobs.ts 29+src/core/ops/loops.ts 9+src/core/ops/orphans.ts 1+src/core/ops/pages.ts 1+src/core/ops/persistence.ts 4+src/core/ops/request-tools.ts 2+src/core/ops/search.ts 2+src/core/ops/skillopt.ts 7+src/core/ops/skills-catalog.ts 3+src/core/ops/sources.ts 4+src/core/ops/sync-status.ts 3+src/core/ops/takes.ts 1+src/core/ops/timeline.ts 3+src/core/ops/transcripts.ts 1+src/core/page-state/import-guard.ts 1+src/core/persistence/activation.ts 5+src/core/persistence/administration.ts 6+src/core/persistence/atom-maintenance.ts 23+src/core/persistence/atom-retry.ts 8+src/core/persistence/authority.ts 1+src/core/persistence/bundle-files.ts 8+src/core/persistence/canonical-projections.ts 3+src/core/persistence/checkpoint-validation.ts 1+src/core/persistence/connector-google-receipts.ts 10+src/core/persistence/connector-sync.ts 39+src/core/persistence/context.ts 1+src/core/persistence/control.ts 1+src/core/persistence/coordinator.ts 17+src/core/persistence/database-write.ts 2+src/core/persistence/deactivation.ts 2+src/core/persistence/derived-facts.ts 5+src/core/persistence/digest.ts 1+src/core/persistence/effect-facts.ts 3+src/core/persistence/effect-git.ts 13+src/core/persistence/effect-journal.ts 1+src/core/persistence/effect-recovery.ts 11+src/core/persistence/effect-retry.ts 12+src/core/persistence/effect-targets.ts 2+src/core/persistence/effects.ts 22+src/core/persistence/embed-facts-administration.ts 3+src/core/persistence/embedding-settlement.ts 1+src/core/persistence/facts-maintenance.ts 19+src/core/persistence/facts-prepare.ts 13+src/core/persistence/grandfather.ts 6+src/core/persistence/identity.ts 9+src/core/persistence/import-mutations.ts 3+src/core/persistence/import-prepare.ts 23+src/core/persistence/ipc.ts 9+src/core/persistence/journal.ts 8+src/core/persistence/limits.ts 1+src/core/persistence/local-client.ts 5+src/core/persistence/loop-fact-retirement.ts 4+src/core/persistence/managed-sources.ts 5+src/core/persistence/memory-mutations.ts 4+src/core/persistence/memory-prepare.ts 5+src/core/persistence/ownership.ts 20+src/core/persistence/page-mutations.ts 6+src/core/persistence/page-prepare.ts 13+src/core/persistence/page-visibility.ts 1+src/core/persistence/prepared-maintenance.ts 26+src/core/persistence/projection-reindex.ts 7+src/core/persistence/protected-takes.ts 2+src/core/persistence/protocol.ts 1+src/core/persistence/provider.ts 4+src/core/persistence/reconcile-audit.ts 13+src/core/persistence/reconcile-backup.ts 17+src/core/persistence/reconcile-merge.ts 13+src/core/persistence/reconcile-prepare.ts 7+src/core/persistence/reconcile-state.ts 11+src/core/persistence/reconcile.ts 11+src/core/persistence/reindex-administration.ts 5+src/core/persistence/root-registry.ts 2+src/core/persistence/semantic-pages.ts 4+src/core/persistence/service.ts 5+src/core/persistence/skill-activation.ts 1+src/core/persistence/source-lifecycle.ts 25+src/core/persistence/staging.ts 2+src/core/persistence/sync-administration.ts 2+src/core/persistence/sync-authority.ts 7+src/core/persistence/sync-discovery.ts 20+src/core/persistence/sync-origin.ts 3+src/core/persistence/sync-prepare.ts 31+src/core/persistence/sync-run.ts 8+src/core/persistence/sync-wire.ts 1+src/core/persistence/takes-prepare.ts 8+src/core/persistence/topology-clone.ts 19+src/core/persistence/topology-filesystem.ts 5+src/core/persistence/topology-locks.ts 9+src/core/persistence/topology-receipts.ts 6+src/core/persistence/topology-recovery.ts 19+src/core/persistence/unbound-source.ts 1+src/core/persistence/worktree-refresh.ts 5+src/core/repair/captured-facts.ts 1+src/core/repair/extractor-facts.ts 2+src/core/repair/stale-atoms.ts 2+src/core/search/evidence-delivery.ts 1+src/core/shared-skills/adapter.ts 2+src/core/shared-skills/catalog.ts 15+src/core/shared-skills/compatibility.ts 2+src/core/shared-skills/manifest.ts 26+src/core/shared-skills/membership-authority.ts 1+src/core/shared-skills/membership.ts 1+src/core/shared-skills/migration-export.ts 25+src/core/shared-skills/migration-projection.ts 2+src/core/shared-skills/migration.ts 8+src/core/shared-skills/optimizer.ts 18+src/core/shared-skills/policy.ts 16+src/core/shared-skills/publication.ts 59+src/core/shared-skills/retention.ts 7+src/core/shared-skills/setup-files.ts 11+src/core/shared-skills/setup-source-policy.ts 2+src/core/shared-skills/setup.ts 14+src/core/skill-catalog.ts 9+src/core/skillpack/brain-resident-locate.ts 12+src/core/skillpack/shared-brain-bridge.ts 7+src/core/skillpack/writer-guard.ts 1+src/core/source-local-reference-index.ts 2+src/mcp/dispatch.ts 2diff --git a/scripts/agent-contract-baselines/throw-new-error-in-ops.tsv b/scripts/agent-contract-baselines/throw-new-error-in-ops.tsvnew file mode 100644index 0000000000..25b430951d--- /dev/null+++ b/scripts/agent-contract-baselines/throw-new-error-in-ops.tsv@@ -0,0 +1,11 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule throw-new-error-in-ops: path<TAB>count+src/core/ops/embedding-migration.ts 1+src/core/ops/image.ts 3+src/core/ops/insights.ts 1+src/core/ops/links.ts 1+src/core/ops/orphans.ts 1+src/core/schema-migrations/v039-multimodal-dual-column-v0-27-1.ts 2+src/core/schema-migrations/v045-facts-hot-memory-v0-31.ts 1+src/mcp/rate-limit.ts 3+src/mcp/source-preflight.ts 1+src/mcp/surface.ts 3diff --git a/scripts/agent-contract-baselines/verify-not-read-only.tsv b/scripts/agent-contract-baselines/verify-not-read-only.tsvnew file mode 100644index 0000000000..d7d64676a2--- /dev/null+++ b/scripts/agent-contract-baselines/verify-not-read-only.tsv@@ -0,0 +1,2 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule verify-not-read-only: path<TAB>count+src/core/budget/no-pricing.ts 1diff --git a/scripts/agent-contract-baselines/yes-rerun-string.tsv b/scripts/agent-contract-baselines/yes-rerun-string.tsvnew file mode 100644index 0000000000..7e30afb24f--- /dev/null+++ b/scripts/agent-contract-baselines/yes-rerun-string.tsv@@ -0,0 +1,19 @@+# shrink-only baseline for scripts/check-agent-contract.ts rule yes-rerun-string: path<TAB>count+src/cli.ts 3+src/commands/apply-migrations.ts 3+src/commands/company-brain-connect.ts 1+src/commands/config.ts 1+src/commands/db-repair.ts 1+src/commands/decide.ts 1+src/commands/decide/probe-query.ts 1+src/commands/doctor/checks/memory-writeback.ts 2+src/commands/dream-retriage.ts 1+src/commands/enrich.ts 1+src/commands/mcp-expose.ts 3+src/commands/migrate-embeddings.ts 1+src/commands/migrations/v0_11_0.ts 1+src/commands/takes.ts 1+src/core/bootstrap/harness.ts 1+src/core/page-state/credential-reseal.ts 1+src/core/schema-migrations/v039-multimodal-dual-column-v0-27-1.ts 2+src/core/schema-migrations/v045-facts-hot-memory-v0-31.ts 1diff --git a/scripts/build-error-codes.ts b/scripts/build-error-codes.tsnew file mode 100644index 0000000000..8e91e11f72--- /dev/null+++ b/scripts/build-error-codes.ts@@ -0,0 +1,25 @@+#!/usr/bin/env bun+/**+ * Generate docs/guides/error-codes.md from the error code registry+ * (src/core/error-registry.ts) — agent contract v1, A2.+ * bun run build:error-codes write the guide+ * bun run build:error-codes --check exit 1 when the committed guide is stale+ */+import { readFileSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import { renderErrorCodesMarkdown } from '../src/core/error-docs.ts';++const path = join(import.meta.dir, '..', 'docs', 'guides', 'error-codes.md');+const fresh = renderErrorCodesMarkdown();+if (process.argv.includes('--check')) {+ let current = '';+ try { current = readFileSync(path, 'utf8'); } catch { /* missing */ }+ if (current !== fresh) {+ console.error('docs/guides/error-codes.md is stale. Run: bun run build:error-codes');+ process.exit(1);+ }+ console.log('error-codes.md: up to date');+} else {+ writeFileSync(path, fresh);+ console.log(`wrote ${path}`);+}diff --git a/scripts/check-agent-contract.ts b/scripts/check-agent-contract.tsnew file mode 100644index 0000000000..0f9129b6ec--- /dev/null+++ b/scripts/check-agent-contract.ts@@ -0,0 +1,270 @@+#!/usr/bin/env bun+/**+ * Agent operator contract scanner (docs/designs/AGENT_OPERATOR_WAVE.md, B9).+ *+ * Syntax-only TypeScript AST walk over src/**\/*.ts. Every rule counts hits+ * per file; per-rule baselines under scripts/agent-contract-baselines/<rule>.tsv+ * (`path<TAB>count`, sorted) are SHRINK-ONLY: a file over its baseline fails+ * (new violation), a file under it fails until the baseline is lowered+ * (`--update` rewrites baselines and refuses any increase). Rules with no+ * baseline file must have zero hits.+ *+ * Rules:+ * suggestionless-operation-error new OperationError(code, msg) without a suggestion (use opError)+ * throw-new-error-in-ops `throw new Error` in src/core/ops/**, src/mcp/** or an op `handler:` body+ * hand-built-command a `fix` / `next_action` value written as a 'gbrain …' string (build argv; shellQuote renders)+ * legacy-advice-key a legacy advice key (next_action, fix_argv, hint, docs_url, …) outside the alias allowlist+ * interactive-io raw stdin/readline/raw-mode reads outside interaction.ts / consent.ts+ * yes-rerun-string a raw "re-run with --yes" string outside consent.ts+ * stdio-inherit `stdio: 'inherit'` outside spawnCliChild (cli-force-exit.ts)+ * marker-literal [AGENT] / [SHOW USER] / "ACTION FOR THE AGENT:" outside agent-output.ts / agent-markers.ts+ * verify-not-read-only a fix `verify.argv` naming a command not declared read_only+ * unregistered-code a literal error code thrown in src/ missing from src/core/error-registry.ts (never baselined)+ * code-naming a registry code that is not snake_case or carries a transport prefix (never baselined)+ *+ * Seam: GBRAIN_GUARD_ROOT (fixture tree; baselines read from <root>/baselines/).+ */+import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';+import { join, relative, sep } from 'node:path';+import ts from 'typescript';++const FIXTURE_ROOT = process.env.GBRAIN_GUARD_ROOT;+const ROOT = FIXTURE_ROOT ?? join(import.meta.dir, '..');+const BASELINE_DIR = FIXTURE_ROOT ? join(FIXTURE_ROOT, 'baselines') : join(ROOT, 'scripts', 'agent-contract-baselines');+const DOCS = 'docs/designs/AGENT_OPERATOR_WAVE.md (B9)';++export type Rule =+ | 'suggestionless-operation-error' | 'throw-new-error-in-ops' | 'hand-built-command' | 'legacy-advice-key'+ | 'interactive-io' | 'yes-rerun-string' | 'stdio-inherit' | 'marker-literal' | 'verify-not-read-only'+ | 'unregistered-code' | 'code-naming';++export const BASELINED_RULES: readonly Rule[] = [+ 'suggestionless-operation-error', 'throw-new-error-in-ops', 'hand-built-command', 'legacy-advice-key',+ 'interactive-io', 'yes-rerun-string', 'stdio-inherit', 'marker-literal', 'verify-not-read-only',+];++export interface Hit { rule: Rule; file: string; line: number; text: string }++const LEGACY_ADVICE_KEYS = new Set(['next_action', 'fix_argv', 'agent_action', 'recovery_action', 'docs_url', 'hint', 'remediation', 'next_step']);+const MARKER_RE = /\[\/?AGENT\]|\[\/?SHOW USER\]|ACTION FOR THE AGENT:/;+const YES_RERUN_RE = /re-?run\b[^.\n]{0,40}--yes/i;+const TRANSPORT_PREFIX = /^(mcp|http|cli|stdio)_/;+/** Read-only invocations a verify step may always name (doctor --only is the canonical one). */+const STATIC_READ_ONLY = new Set(['doctor', 'errors', 'status', 'get', 'search', 'query', 'list', 'write-request', 'write-requests', 'whoami', 'stats']);++function tsFiles(dir: string): string[] {+ if (!existsSync(dir)) return [];+ const out: string[] = [];+ for (const e of readdirSync(dir).sort()) {+ const full = join(dir, e);+ if (statSync(full).isDirectory()) out.push(...tsFiles(full));+ else if (e.endsWith('.ts') && !e.endsWith('.generated.ts')) out.push(full);+ }+ return out;+}++const rel = (f: string) => relative(ROOT, f).split(sep).join('/');++function stringText(n: ts.Node): string | undefined {+ if (ts.isStringLiteral(n) || ts.isNoSubstitutionTemplateLiteral(n)) return n.text;+ if (ts.isTemplateExpression(n)) return n.head.text + n.templateSpans.map(s => s.literal.text).join('');+ return undefined;+}++function literalCodes(n: ts.Node): string[] {+ if (ts.isStringLiteral(n) || ts.isNoSubstitutionTemplateLiteral(n)) return [n.text];+ if (ts.isConditionalExpression(n)) return [...literalCodes(n.whenTrue), ...literalCodes(n.whenFalse)];+ if (ts.isParenthesizedExpression(n)) return literalCodes(n.expression);+ return [];+}++function propName(n: ts.ObjectLiteralElementLike): string | undefined {+ if (!n.name) return undefined;+ if (ts.isIdentifier(n.name) || ts.isStringLiteral(n.name)) return n.name.text;+ return undefined;+}++function insideHandler(n: ts.Node): boolean {+ for (let p = n.parent; p; p = p.parent) {+ if (ts.isPropertyAssignment(p) && propName(p) === 'handler') return true;+ }+ return false;+}++/** Every literal error code thrown in one file (OperationError family, StructuredError builders, CredentialError). */+export function collectThrownCodes(sf: ts.SourceFile): Array<{ code: string; line: number }> {+ const out: Array<{ code: string; line: number }> = [];+ const visit = (n: ts.Node) => {+ if ((ts.isNewExpression(n) || ts.isCallExpression(n)) && n.arguments?.length) {+ const callee = n.expression.getText(sf);+ const line = sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1;+ if (/^(OperationError|verbError|opError|OperationError\.bare|CredentialError)$/.test(callee)) {+ for (const code of literalCodes(n.arguments[0])) out.push({ code, line });+ } else if (/^(errorFor|buildError)$/.test(callee) && ts.isObjectLiteralExpression(n.arguments[0])) {+ for (const p of n.arguments[0].properties) {+ if (ts.isPropertyAssignment(p) && propName(p) === 'code') for (const code of literalCodes(p.initializer)) out.push({ code, line });+ }+ }+ }+ ts.forEachChild(n, visit);+ };+ visit(sf);+ return out;+}++/** Registered codes, parsed syntactically from the registry module (fixture-safe). */+export function registeredCodes(root: string = ROOT): Set<string> | null {+ const path = join(root, 'src', 'core', 'error-registry.ts');+ if (!existsSync(path)) return null;+ const text = readFileSync(path, 'utf8');+ const body = text.slice(text.indexOf('export const CODES'));+ return new Set([...body.matchAll(/^ {2}([a-z0-9_]+): \{/gm)].map(m => m[1]!));+}++function readOnlyCommands(root: string): Set<string> {+ const set = new Set(STATIC_READ_ONLY);+ const table = join(root, 'src', 'cli', 'command-table.ts');+ if (existsSync(table)) {+ for (const m of readFileSync(table, 'utf8').matchAll(/\{ name: '([a-z0-9-]+)'[^\n]*read_only: true/g)) set.add(m[1]!);+ }+ return set;+}++export function scan(root: string = ROOT): Hit[] {+ const hits: Hit[] = [];+ const readOnly = readOnlyCommands(root);+ const registry = registeredCodes(root);+ for (const file of tsFiles(join(root, 'src'))) {+ const path = rel(file);+ const text = readFileSync(file, 'utf8');+ const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true);+ const isOpsOrMcp = path.startsWith('src/core/ops/') || path.startsWith('src/mcp/');+ const ioExempt = path === 'src/core/interaction.ts' || path === 'src/core/consent.ts';+ const markerExempt = path === 'src/core/agent-output.ts' || path === 'src/core/agent-markers.ts';+ const add = (rule: Rule, n: ts.Node) => hits.push({+ rule, file: path, line: sf.getLineAndCharacterOfPosition(n.getStart(sf)).line + 1,+ text: n.getText(sf).split('\n')[0]!.slice(0, 120),+ });+ const visit = (n: ts.Node) => {+ if (ts.isNewExpression(n) && n.expression.getText(sf) === 'OperationError' && path !== 'src/core/ops/contract.ts') {+ const args = n.arguments ?? [];+ if (args.length < 3 || args[2]!.getText(sf) === 'undefined') add('suggestionless-operation-error', n);+ }+ if (ts.isThrowStatement(n) && n.expression && ts.isNewExpression(n.expression) && n.expression.expression.getText(sf) === 'Error'+ && (isOpsOrMcp || insideHandler(n))) add('throw-new-error-in-ops', n);+ if (ts.isPropertyAssignment(n)) {+ const name = propName(n);+ const value = stringText(n.initializer);+ if ((name === 'fix' || name === 'next_action') && value !== undefined && /(^|`|\s)gbrain /.test(value)) add('hand-built-command', n);+ if (name && LEGACY_ADVICE_KEYS.has(name)) add('legacy-advice-key', n);+ if (name === 'stdio' && value === 'inherit' && path !== 'src/core/cli-force-exit.ts') add('stdio-inherit', n);+ if (name === 'verify' && ts.isObjectLiteralExpression(n.initializer)) {+ for (const p of n.initializer.properties) {+ if (!ts.isPropertyAssignment(p) || propName(p) !== 'argv' || !ts.isArrayLiteralExpression(p.initializer)) continue;+ const words = p.initializer.elements.map(e => stringText(e));+ if (words[0] === 'gbrain' && words[1] !== undefined && !readOnly.has(words[1]!)) add('verify-not-read-only', p);+ }+ }+ }+ if (ts.isShorthandPropertyAssignment(n) && LEGACY_ADVICE_KEYS.has(n.name.text)) add('legacy-advice-key', n);+ if (!ioExempt) {+ if (ts.isCallExpression(n)) {+ const callee = n.expression.getText(sf);+ if (/(^|\.)createInterface$/.test(callee) || /^process\.stdin\.(on|once)$/.test(callee) || /\.setRawMode$/.test(callee)) add('interactive-io', n);+ if (/(^|\.)readFileSync$/.test(callee) && n.arguments[0] && stringText(n.arguments[0]) === '/dev/stdin') add('interactive-io', n);+ }+ if (ts.isForOfStatement(n) && n.awaitModifier && n.expression.getText(sf) === 'process.stdin') add('interactive-io', n);+ }+ const lit = stringText(n);+ if (lit !== undefined && (ts.isStringLiteral(n) || ts.isNoSubstitutionTemplateLiteral(n) || ts.isTemplateExpression(n))) {+ if (!markerExempt && MARKER_RE.test(lit)) add('marker-literal', n);+ if (path !== 'src/core/consent.ts' && YES_RERUN_RE.test(lit)) add('yes-rerun-string', n);+ }+ ts.forEachChild(n, visit);+ };+ visit(sf);+ if (registry) {+ for (const { code, line } of collectThrownCodes(sf)) {+ if (!registry.has(code)) hits.push({ rule: 'unregistered-code', file: path, line, text: code });+ }+ }+ }+ if (registry) {+ for (const code of registry) {+ if (!/^[a-z][a-z0-9_]*$/.test(code) || TRANSPORT_PREFIX.test(code)) {+ hits.push({ rule: 'code-naming', file: 'src/core/error-registry.ts', line: 0, text: code });+ }+ }+ }+ return hits;+}++function readBaseline(rule: Rule): Map<string, number> | null {+ const path = join(BASELINE_DIR, `${rule}.tsv`);+ if (!existsSync(path)) return null;+ const m = new Map<string, number>();+ for (const line of readFileSync(path, 'utf8').split('\n')) {+ if (!line || line.startsWith('#')) continue;+ const [file, count] = line.split('\t');+ m.set(file!, Number(count));+ }+ return m;+}++function countsByFile(hits: Hit[], rule: Rule): Map<string, number> {+ const m = new Map<string, number>();+ for (const h of hits) if (h.rule === rule) m.set(h.file, (m.get(h.file) ?? 0) + 1);+ return m;+}++function writeBaseline(rule: Rule, counts: Map<string, number>): void {+ mkdirSync(BASELINE_DIR, { recursive: true });+ const lines = [...counts.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([f, c]) => `${f}\t${c}`);+ writeFileSync(join(BASELINE_DIR, `${rule}.tsv`),+ `# shrink-only baseline for scripts/check-agent-contract.ts rule ${rule}: path<TAB>count\n${lines.join('\n')}${lines.length ? '\n' : ''}`);+}++function main(): number {+ const update = process.argv.includes('--update');+ const started = performance.now();+ const hits = scan();+ const failures: string[] = [];+ for (const h of hits) {+ if (h.rule === 'unregistered-code') failures.push(`${h.file}:${h.line} [unregistered-code] '${h.text}' is thrown but not registered — add a row to src/core/error-registry.ts, then bun run build:error-codes`);+ if (h.rule === 'code-naming') failures.push(`[code-naming] registry code '${h.text}' must be snake_case with no transport prefix`);+ }+ for (const rule of BASELINED_RULES) {+ const counts = countsByFile(hits, rule);+ const baseline = readBaseline(rule) ?? new Map<string, number>();+ if (update) {+ const grew = [...counts].filter(([f, c]) => c > (baseline.get(f) ?? 0));+ if (grew.length && !process.argv.includes('--allow-grow')) {+ for (const [f, c] of grew) failures.push(`${f} [${rule}] ${c} > baseline ${baseline.get(f) ?? 0}: --update only shrinks baselines`);+ } else {+ writeBaseline(rule, counts);+ }+ continue;+ }+ for (const [file, count] of counts) {+ const allowed = baseline.get(file) ?? 0;+ if (count > allowed) {+ const where = hits.filter(h => h.rule === rule && h.file === file).map(h => ` ${h.file}:${h.line} ${h.text}`).join('\n');+ failures.push(`${file} [${rule}] ${count} hit(s), baseline ${allowed}. New violation(s):\n${where}`);+ }+ }+ for (const [file, allowed] of baseline) {+ const count = counts.get(file) ?? 0;+ if (count < allowed) failures.push(`${file} [${rule}] shrank to ${count} (baseline ${allowed}): lower the baseline with bun scripts/check-agent-contract.ts --update`);+ }+ }+ const ms = Math.round(performance.now() - started);+ if (failures.length) {+ for (const f of failures) console.error(`FAIL ${f}`);+ console.error(`check-agent-contract: ${failures.length} failure(s) in ${ms}ms. See ${DOCS}.`);+ return 1;+ }+ console.log(`check-agent-contract: OK (${hits.length} baselined hits, ${ms}ms)`);+ return 0;+}++if (import.meta.main) process.exit(main());diff --git a/scripts/guards-manifest.tsv b/scripts/guards-manifest.tsvindex 18561943d3..c434da1acc 100644--- a/scripts/guards-manifest.tsv+++ b/scripts/guards-manifest.tsv@@ -83,3 +83,4 @@ check-getpage-scoped-write.mjs scanner yes unscoped-getPage + write co-occurrenccheck-orphan-modules.mjs scanner yes runtime-reachability walk (static+dynamic relative imports) from cli/mcp/plugin/admin entrypoints + package.json exports; hard-fails untested orphans, requires a reasoned PERMITTED_TEST_ONLY entry per test-only module (stale entries fail); fixture root via argv/GBRAIN_GUARD_ROOT; knip v5 evaluated + rejected (crashes on repo layout — see script header)check-test-placeholders.mjs scanner yes TypeScript AST (CallExpression) scan of test/**/*.test.ts for no-op expect(true)/expect(1) placeholders; path+test+count allowlist (disabled in fixture mode); fixture root via argv/GBRAIN_GUARD_ROOT; in verify CHECKScheck-test-discriminates.sh buildfresh exempt manual per-PR discrimination helper (#3665): reverts named source files to their pre-fix state and runs the named test file to prove it fails without the fix — the test run IS the check; not in verify CHECKS or CI+check-agent-contract.ts scanner yes agent operator contract v1 (B9): syntax-only TS AST; per-rule shrink-only baselines in scripts/agent-contract-baselines/; registry completeness + code naming never baselined; GBRAIN_GUARD_ROOT seam (baselines from <root>/baselines)diff --git a/scripts/run-verify-parallel.sh b/scripts/run-verify-parallel.shindex 240b3bf1f2..ef451d1f6d 100755--- a/scripts/run-verify-parallel.sh+++ b/scripts/run-verify-parallel.sh@@ -61,6 +61,10 @@ CHECKS=(# true orphans (unreachable from every entrypoint AND every test) and any# test-only module without a reasoned PERMITTED_TEST_ONLY entry. ~1s."check:orphan-modules"+ # agent contract v1 (A2): generated docs/guides/error-codes.md matches the registry+ "check:error-codes"+ # agent contract v1 scanner (B9): shrink-only per-rule baselines+ "check:agent-contract"# No-op placeholder assertions (expect(true).toBe(true) and friends) in# test/**/*.test.ts; TypeScript AST scan, ~3s over the full corpus."check:test-placeholders"diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsvindex 0add47e6c1..57b047abd6 100644--- a/scripts/structural-suites.tsv+++ b/scripts/structural-suites.tsv@@ -137,6 +137,7 @@ test/embed-concurrency-pool-clamp.test.ts #5183 embed concurrency never exceedstest/embedding-dim-check-facts.test.ts doctor checkFactsEmbeddingWidthConsistency wiring (T6) 4 doctor-source-helpertest/embedding-dim-check-facts.test.ts postgres-engine fact insert cast (T6, codex #20) 1 source-surface-helpertest/env-trust-protected-keys.test.ts CWD_DOTENV_PROTECTED_KEYS covers every suspicious GBRAIN_* env read in src/ 3 readFileSync+test/error-catalogue.test.ts error code registry (agent contract v1) 5 readFileSynctest/eval-brainbench-e2e.slow.test.ts --llm availability gate 1 exec-scantest/eval-brainbench-e2e.slow.test.ts privacy guard violation branches (negative path) 1 exec-scantest/eval-brainbench-e2e.slow.test.ts render-brainbench-delta.ts (the CI step-summary block) 2 exec-scandiff --git a/src/cli/command-table.ts b/src/cli/command-table.tsindex f23e8d2014..2ac92a07ee 100644--- a/src/cli/command-table.ts+++ b/src/cli/command-table.ts@@ -122,6 +122,7 @@ export const CLI_COMMANDS: readonly CliCommandRecord[] = [ // Pre-connect: disp// selfHelp: MEMORY_VERBS v1 (Cathedral 1): protocol ships its own detailed HELP (subcommands,// conformance targets, the cost-gated --synthesize flag).{ name: 'protocol', phase: 'pre-connect', thinClient: 'none', selfHelp: true, load: () => import('./commands/protocol.ts') },+ { name: 'errors', phase: 'pre-connect', thinClient: 'none', selfHelp: true, json: 'document', read_only: true, load: () => import('./commands/errors.ts') },// selfHelp: `gbrain init --help` prints its own usage from runInit; route around the generic// one-line short-circuit (matches `connect`). Without this, `init` is in CLI_ONLY but not// CLI_ONLY_SELF_HELP, so the dispatcher's generic short-circuit fires and the printInitHelp()diff --git a/src/cli/commands/errors.ts b/src/cli/commands/errors.tsnew file mode 100644index 0000000000..b7678a764e--- /dev/null+++ b/src/cli/commands/errors.ts@@ -0,0 +1,59 @@+/**+ * `gbrain errors <code> [--json]` / `gbrain errors --changed [--json]` /+ * `gbrain errors [--json]`: offline lookup in the error code registry+ * (agent contract v1, A2). Engine-free; the same rows as+ * docs/guides/error-codes.md.+ */+import { writeStdoutFinal, setCliExitVerdict } from '../../core/cli-force-exit.ts';+import { CODES } from '../../core/error-catalogue.ts';+import { changedCodeRows, errorCodeRow, renderErrorCodeText } from '../../core/error-docs.ts';+import { suggestNearest } from '../../core/levenshtein.ts';++const HELP = `Usage: gbrain errors [<code>] [--changed] [--json]++Look up a gbrain error code offline: what it means, why it happens, the next+step, who acts, and how to verify.++ gbrain errors <code> one code (exit 2 when unknown, with a did-you-mean)+ gbrain errors --changed codes whose legacy \`error\` value differs from \`code\`+ gbrain errors every code, one line each+ --json machine-readable output+`;++export async function run(args: string[]): Promise<void> {+ if (args.includes('--help') || args.includes('-h')) {+ await writeStdoutFinal(HELP);+ return;+ }+ const json = args.includes('--json');+ const code = args.filter(a => !a.startsWith('-'))[0];+ if (args.includes('--changed')) {+ const rows = changedCodeRows();+ await writeStdoutFinal(json ? `${JSON.stringify({ codes: rows }, null, 2)}\n` : `${rows.map(renderErrorCodeText).join('\n\n')}\n`);+ return;+ }+ if (!code) {+ const all = Object.keys(CODES).sort().map(c => errorCodeRow(c)!);+ await writeStdoutFinal(json+ ? `${JSON.stringify({ codes: all }, null, 2)}\n`+ : `${all.map(r => `${r.code.padEnd(36)} ${r.class.padEnd(11)} ${r.meaning}`).join('\n')}\n`);+ return;+ }+ const row = errorCodeRow(code);+ if (!row) {+ const nearest = suggestNearest(code, Object.keys(CODES));+ const message = `Unknown error code: ${code}.${nearest ? ` Did you mean "${nearest}"?` : ''}`;+ if (json) {+ await writeStdoutFinal(`${JSON.stringify({+ error: 'invalid_params', code: 'invalid_params', message,+ suggestion: 'Run `gbrain errors` to list every code.', contract_version: 1,+ }, null, 2)}\n`);+ } else {+ console.error(message);+ console.error('Run `gbrain errors` to list every code.');+ }+ setCliExitVerdict(2);+ return;+ }+ await writeStdoutFinal(json ? `${JSON.stringify(row, null, 2)}\n` : `${renderErrorCodeText(row)}\n`);+}diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.tsindex 25bb58d64e..577eb6e428 100644--- a/src/core/cli-flag-registry.generated.ts+++ b/src/core/cli-flag-registry.generated.ts@@ -52,6 +52,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'embed': ['--accept-pending', '--all', '--background', '--batch-size', '--brain', '--break-lock', '--budget-ms', '--catch-up', '--db-url', '--dim', '--dry-run', '--embedding-dimensions', '--embedding-model', '--explain', '--facts', '--follow', '--force', '--help', '--images', '--include-null-signature', '--json', '--max-cost-usd', '--max-facts', '--no-accept-pending', '--no-embed', '--no-embedding', '--pace', '--pace-max-concurrency', '--path', '--pglite', '--priority', '--progress-interval', '--progress-json', '--quiet', '--show-toplevel', '--slugs', '--source', '--stale', '--status', '--supabase', '--timeout', '--to', '--wait', '--yes'],'engine': ['--apply-rewrites', '--brain', '--break-lock', '--db-url', '--help', '--http', '--json', '--path', '--prefer-postgres', '--probe', '--source', '--supabase', '--url', '--yes'],'enrich': ['--accept-pending', '--access', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--concurrency', '--confirm-destructive', '--date', '--days', '--dry-run', '--embedding-dimensions', '--embedding-model', '--entities', '--explain', '--fact', '--federated-read', '--file', '--follow', '--force', '--full', '--help', '--http', '--image', '--input', '--json', '--kind', '--limit', '--max-cost', '--max-cost-usd', '--max-runtime', '--max-usd', '--min-context', '--mode', '--model', '--multimodal', '--no-accept-pending', '--once', '--order', '--output', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--rate', '--reenrich-after', '--resume', '--session', '--since', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stats', '--status', '--surface', '--take', '--thin', '--thin-threshold', '--timeline', '--timeout', '--trusted-extraction', '--types', '--url', '--wait', '--workers', '--yes'],+ 'errors': ['--brain', '--changed', '--help', '--json', '--source'],'eval': ['--ab-relational', '--accept-pending', '--against', '--allow-incomplete-judgments', '--allow-mixed-run-config', '--allow-regression', '--asof', '--autocut', '--background', '--baseline', '--batch', '--brain', '--budget-usd', '--budget-usd-answer', '--budget-usd-retrieval', '--by-type', '--by-type-floor', '--by-type-floor-metric', '--candidate', '--capture-pool', '--committed-baseline', '--compare', '--compare-limit', '--concurrent', '--config-a', '--config-b', '--corpus', '--cycles', '--days', '--decide', '--decide-calibration', '--decide-dataset', '--decide-force-on', '--decide-provider', '--decide-threshold', '--dedup-cosine', '--dedup-max-per-page', '--dedup-type-ratio', '--dimensions', '--distance-min', '--draws', '--embed-cache', '--embedder', '--embedding-dimensions', '--embedding-model', '--eval-pool-depth', '--expand', '--expansion', '--expansion-replay', '--expansion-variant-budget', '--explain', '--fixtures', '--follow', '--force-rechunk', '--format', '--from-capture', '--from-db', '--gold', '--grounding-min', '--harness', '--help', '--include-abstention', '--include-holdout', '--input', '--json', '--judge', '--judge-concurrency', '--judge-model', '--justification', '--k', '--keyword-only', '--limit', '--llm', '--max-pair-chars', '--max-tokens', '--max-usd', '--mcp-only', '--md', '--metric', '--min-recall', '--mode', '--model', '--models', '--modes', '--name-only', '--no-accept-pending', '--no-cache', '--no-embed-cache', '--no-expand', '--no-llm', '--no-trajectory', '--older-than', '--out', '--output', '--output-dir', '--parallel', '--parity-baseline', '--pglite', '--progress-interval', '--progress-json', '--qrels', '--queries-file', '--query', '--question-ids', '--questions', '--quiet', '--reader-max-tokens', '--reader-mode', '--receipt-dir', '--record', '--refresh-cache', '--reranker', '--resume-from', '--retrieval-only', '--rrf-k', '--rubric-version', '--runs', '--sample', '--sampling', '--save', '--search-pin', '--seed', '--severity', '--short', '--show-toplevel', '--since', '--skip-replay', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slug-prefix', '--source', '--stale', '--status', '--strategy', '--suite', '--suites', '--supabase', '--task', '--threshold', '--threshold-expected-top1', '--threshold-first-relevant-hit', '--threshold-jaccard', '--threshold-latency-multiplier', '--threshold-recall-at-k', '--threshold-top1', '--timeout', '--tool', '--top-k', '--top-regressions', '--until', '--update-baseline', '--usefulness-min', '--vectors', '--verbose', '--verify', '--wait', '--with-code-intel', '--yes'],'export': ['--accept-pending', '--background', '--brain', '--dir', '--explain', '--fix', '--follow', '--help', '--json', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--repo', '--restore-only', '--slug-prefix', '--source', '--timeout', '--type', '--wait'],'extract': ['--accept-pending', '--admin-intent', '--after-slug', '--apply-preview', '--background', '--backup-verified', '--brain', '--break-lock', '--by-mention', '--catch-up', '--checkpoint', '--concurrency', '--confirm', '--db-url', '--dir', '--dry-run', '--expected-epoch', '--expected-state', '--explain', '--follow', '--from-meetings', '--help', '--include-frontmatter', '--infer-dates', '--json', '--kind', '--limit', '--manifest', '--ner', '--no-accept-pending', '--pack', '--path', '--progress-interval', '--progress-json', '--prune-orphans', '--quiet', '--rebuild', '--repair-attendance', '--self-transfer', '--since', '--source', '--source-id', '--stale', '--timeout', '--type', '--verbose', '--wait', '--workers', '--yes'],@@ -72,7 +73,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'integrity': ['--accept-pending', '--auto', '--backend', '--background', '--brain', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--supabase', '--timeout', '--type', '--url', '--wait'],'jobs': ['--abbrev-ref', '--access', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--cli-path', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--cost-estimate', '--date', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--explain', '--fact', '--facts', '--federated-read', '--file', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-meetings', '--full', '--full-history', '--hard-deadline', '--health-interval', '--help', '--http', '--idempotency-key', '--ids', '--image', '--images', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--kind', '--limit', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--mcp-only', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name-only', '--ner', '--nice', '--no-auto-embed', '--no-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-pull', '--no-renames', '--no-schema-pack', '--no-verify', '--no-worker', '--now', '--older-than', '--once', '--order', '--others', '--output', '--override-disabled', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--prune-orphans', '--queue', '--quiet', '--reason', '--rebuild', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--review-lower', '--segment-limit', '--select', '--serial', '--session', '--show-toplevel', '--sigkill-rescue', '--since', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--stats', '--status', '--strategy', '--surface', '--swap-only', '--take', '--target', '--thin', '--thin-threshold', '--timeline', '--timeout', '--timeout-ms', '--trusted-extraction', '--type', '--types', '--uninstall', '--url', '--user', '--vectors', '--verbose', '--verify', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],'lint': ['--abbrev-ref', '--abort', '--accept-pending', '--all', '--background', '--brain', '--branch', '--cached', '--dry-run', '--exclude', '--exit-code', '--explain', '--file', '--fix', '--follow', '--get', '--get-url', '--git-dir', '--git-path', '--help', '--is-ancestor', '--is-inside-work-tree', '--json', '--local', '--name-only', '--no-accept-pending', '--no-cron', '--no-tags', '--no-verify', '--no-write-fetch-head', '--pat-file', '--path', '--progress-interval', '--progress-json', '--push', '--push-only', '--quiet', '--rebase', '--short', '--show-toplevel', '--source', '--timeout', '--unset-all', '--wait'],- 'loops': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--top', '--type'],+ 'loops': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--tools-json', '--top', '--type'],'lsd': ['--brain', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],'maintain': ['--adopt-columns', '--adopt-permissions', '--all', '--apply', '--background', '--brain', '--break-lock', '--by-mention', '--catch-up', '--concurrency', '--content-audit', '--count', '--detach', '--dim', '--dir', '--drain', '--dry-run', '--expect', '--explain', '--facts', '--fast', '--fix', '--follow', '--force', '--force-retry', '--force-schema', '--from-meetings', '--full', '--harness', '--help', '--http', '--id', '--include-ambiguous', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-repairs', '--index-audit', '--infer-dates', '--install', '--json', '--kind', '--lang', '--link-source', '--link-type', '--locks', '--markdown', '--max-cost', '--max-cost-usd', '--max-jobs', '--max-rss', '--max-usd', '--migrate-legacy', '--migrate-only', '--multimodal', '--ner', '--no-autopilot-install', '--no-embed', '--no-pull', '--older-than', '--operations', '--pack', '--parallel', '--params', '--path', '--pglite', '--phase', '--pid-file', '--porcelain', '--preview', '--probe-pglite', '--prune-orphans', '--query', '--queue', '--reauth', '--rebuild', '--regenerate', '--remediate', '--remediation-plan', '--remove', '--request-id', '--reset', '--resume', '--retry-failed', '--safe', '--scope', '--scopes', '--show-current', '--since', '--skills-dir', '--skip-failed', '--slot', '--slugs', '--source', '--source-id', '--sources', '--stale', '--status', '--supabase', '--symbol-kind', '--takes-holders', '--target', '--target-score', '--to', '--token', '--top-k', '--type', '--url', '--verbose', '--version', '--window', '--workers', '--yes'],'mcp': ['--admin-token-file', '--agent', '--arg', '--bearer-token-env-var', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--client', '--credentials-file', '--credentials-out', '--delegate', '--delegated-namespace', '--delegated-slug-prefixes', '--dry-run', '--enable-dcr', '--federated-read', '--flow', '--force', '--funnel', '--harness', '--header', '--help', '--if-version', '--install', '--issuer-url', '--json', '--limit', '--mcp-only', '--mcp-url', '--no-install', '--no-service', '--no-tailscale', '--oauth-client-id', '--oauth-client-secret', '--oauth-request', '--port', '--profile', '--queue', '--redirect-uri', '--remove', '--resume', '--root', '--scope', '--scopes', '--skills', '--source', '--sources', '--status', '--surface', '--timeout-ms', '--token', '--token-endpoint-auth-method', '--token-ttl', '--url', '--yes'],@@ -109,7 +110,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'salience': ['--brain', '--days', '--help', '--json', '--kind', '--limit', '--mcp-only', '--slug-prefix', '--source'],'schema': ['--alias', '--apply', '--as-filing-rules', '--brain', '--dims', '--expert', '--expert-routing', '--extractable', '--force', '--help', '--inverse', '--json', '--kind', '--pack', '--page-type', '--prefix', '--primitive', '--schema-pack', '--since', '--source', '--source-id', '--target-type', '--to', '--with-db'],'self-upgrade': ['--brain', '--check-only', '--ff-only', '--force', '--force-retry', '--help', '--json', '--markdown', '--migrate-only', '--no-autopilot-install', '--no-bun-floor-check', '--non-interactive', '--refresh-cache', '--remediation-plan', '--source', '--swap-only', '--version', '--yes'],- 'serve': ['--access', '--apply-rewrites', '--bind', '--brain', '--enable-dcr', '--enable-dcr-insecure', '--help', '--http', '--json', '--log-full-params', '--oauth-request', '--operations', '--port', '--prefer-postgres', '--print-admin-token', '--public-url', '--source', '--source-guard', '--stdio-idle-timeout', '--suppress-bootstrap-token', '--surface', '--token-ttl', '--url', '--yes'],+ 'serve': ['--access', '--apply-rewrites', '--bind', '--brain', '--enable-dcr', '--enable-dcr-insecure', '--help', '--http', '--json', '--log-full-params', '--oauth-request', '--operations', '--port', '--prefer-postgres', '--print-admin-token', '--public-url', '--source', '--source-guard', '--stdio-idle-timeout', '--suppress-bootstrap-token', '--surface', '--token-ttl', '--tools-json', '--url', '--yes'],'skillify': ['--brain', '--description', '--dry-run', '--force', '--help', '--json', '--mutating', '--recent', '--skills-dir', '--source', '--strict', '--triggers', '--writes-pages', '--writes-to'],'skillopt': ['--all', '--allow-mutate-bundled', '--background', '--batch-size', '--benchmark', '--bootstrap-from-routing', '--bootstrap-from-skill', '--bootstrap-reviewed', '--bootstrap-tasks', '--brain', '--brain-wide-max-cost-usd', '--dry-run', '--epochs', '--follow', '--force', '--held-out', '--help', '--json', '--judge-model', '--lr', '--lr-schedule', '--max-cost-usd', '--max-runtime-min', '--models-strict', '--no-max-cost', '--no-mutate', '--optimizer-model', '--patch', '--reflect-max-tokens', '--resume', '--rewrite', '--skills-dir', '--source', '--split', '--status', '--target-model', '--target-models'],'skillpack': ['--all', '--apply-clean-hunks', '--author', '--auto', '--brain', '--dest', '--dry-run', '--env', '--exit-code', '--fast', '--fix', '--force-unlock', '--format', '--from', '--full', '--harness', '--help', '--homepage', '--json', '--license', '--list', '--minimal', '--name-only', '--no-cache', '--no-lint', '--note', '--out', '--overwrite-local', '--persona', '--pure', '--push', '--quick', '--quiet', '--refresh', '--repo', '--schema-pack', '--scope', '--short', '--since', '--skill', '--skills', '--skills-dir', '--skip-doctor', '--source', '--strict', '--stub', '--supabase', '--target', '--tier', '--trust', '--url', '--verify', '--workspace', '--yes'],@@ -124,7 +125,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'think': ['--anchor', '--brain', '--calibration-holder', '--help', '--json', '--mcp-only', '--model', '--rounds', '--save', '--since', '--source', '--take', '--until', '--with-calibration'],'transcripts': ['--accept-pending', '--all', '--all-discovery', '--background', '--brain', '--days', '--dry-run', '--embed', '--explain', '--facts', '--follow', '--format', '--full', '--help', '--include-self', '--json', '--limit', '--max-bytes', '--max-cost-usd', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--since', '--source', '--source-id', '--timeout', '--wait'],'upgrade': ['--acknowledge-no-backup', '--admin-intent', '--all', '--apply', '--apply-clean-hunks', '--backup-confirmed', '--brain', '--check', '--concurrency', '--confirm-quiesced', '--content-root', '--cost-estimate', '--embedding-dimensions', '--embedding-model', '--expected-epoch', '--expected-state', '--export-db-only', '--export-source', '--ff-only', '--force', '--force-all', '--force-orchestrator', '--force-retry', '--force-schema', '--format', '--help', '--host-dir', '--inject-bootstrap', '--inline', '--install', '--interval', '--json', '--limit', '--list', '--manifest', '--markdown', '--max-rss', '--migrate-only', '--migration', '--mode', '--multimodal', '--name-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-embed', '--no-inject', '--no-worker', '--non-interactive', '--now', '--once', '--path', '--pause', '--quiet', '--reason', '--remediation-plan', '--repo', '--require-db', '--resume', '--self-transfer', '--skills-dir', '--skip-verify', '--source', '--stale', '--status', '--swap-only', '--target', '--uninstall', '--user', '--vectors', '--verify', '--version', '--workers', '--yes'],- 'waiting': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--top', '--type'],+ 'waiting': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--tools-json', '--top', '--type'],'watch': ['--brain', '--help', '--json', '--max-pages', '--min-confidence', '--source', '--window-turns'],'whoknows': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--file', '--full', '--help', '--http', '--image', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--once', '--page', '--path', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--trusted-extraction', '--types', '--url', '--yes'],};diff --git a/src/core/error-docs.ts b/src/core/error-docs.tsnew file mode 100644index 0000000000..9170898cf7--- /dev/null+++ b/src/core/error-docs.ts@@ -0,0 +1,124 @@+/**+ * Renders the error code registry (agent contract v1, A2) for people and+ * agents: `docs/guides/error-codes.md` (generated by `bun run+ * build:error-codes`, drift-checked by test/error-codes-doc.test.ts) and+ * `gbrain errors <code>` / `gbrain errors --changed`, offline, from the same+ * rows so the two can never disagree.+ */+import { CODES, codeEntry, exitCodeForCode, codeRetryable, type CodeEntry, type RegistryCode } from './error-catalogue.ts';+import { docsUrl, shellQuote, type ErrorClass } from './agent-output.ts';++export interface ErrorCodeRow {+ code: string;+ class: ErrorClass;+ meaning: string;+ why: string;+ next_step: string;+ effects: string[];+ actor: string;+ verify: string;+ exit_code: number;+ retryable: boolean;+ docs: string;+ legacy_error?: string;+ renamed_from?: string;+ reasons?: readonly string[];+}++const CLASS_WHY: Record<ErrorClass, string> = {+ caller: 'The request itself was wrong or no longer matches the brain; nothing was changed.',+ consent: 'The step needs the user\'s decision before it runs.',+ retryable: 'A temporary condition (a lock, a pending write, a rate limit); the same request can succeed later.',+ unavailable: 'A capability this request needs is not configured or not reachable on this brain.',+ server: 'The server failed; this is not a caller mistake.',+ host_only: 'Only the operator of the brain host can change what blocks this.',+};++const CLASS_ACTOR: Record<ErrorClass, string> = {+ caller: 'agent', consent: 'user', retryable: 'agent', unavailable: 'agent', server: 'host_admin', host_only: 'host_admin',+};++export function errorCodeRow(code: string): ErrorCodeRow | undefined {+ const e = codeEntry(code);+ if (!e) return undefined;+ const fixCmd = e.fix?.argv ? shellQuote(e.fix.argv) : undefined;+ const verify = e.fix?.verify?.argv ? shellQuote(e.fix.verify.argv)+ : e.class === 'server' || e.class === 'unavailable' || e.class === 'host_only' ? 'gbrain doctor --json' : 'repeat the read that failed';+ return {+ code,+ class: e.class,+ meaning: e.summary,+ why: e.why ?? CLASS_WHY[e.class],+ next_step: fixCmd ? `${e.suggestion} Run: ${fixCmd}` : e.suggestion,+ effects: [...(e.effects ?? e.fix?.consent ?? [])],+ actor: e.actor ?? e.fix?.actor ?? CLASS_ACTOR[e.class],+ verify,+ exit_code: exitCodeForCode(code),+ retryable: codeRetryable(code),+ docs: e.docs,+ ...(e.legacy_error ? { legacy_error: e.legacy_error } : {}),+ ...(e.renamed_from ? { renamed_from: e.renamed_from } : {}),+ ...(e.reasons?.length ? { reasons: e.reasons } : {}),+ };+}++/** Codes whose wire `error` value stays frozen under v1 while `code` carries the canonical value. */+export function changedCodeRows(): ErrorCodeRow[] {+ return (Object.keys(CODES) as RegistryCode[])+ .filter(c => (CODES[c] as CodeEntry).legacy_error !== undefined || (CODES[c] as CodeEntry).renamed_from !== undefined)+ .map(c => errorCodeRow(c)!);+}++const cell = (s: string) => s.replace(/\|/g, '\\|').replace(/\n/g, ' ');++export function renderErrorCodeText(r: ErrorCodeRow): string {+ return [+ `${r.code} (${r.class}, exit ${r.exit_code}${r.retryable ? ', retryable' : ''})`,+ ` meaning: ${r.meaning}`,+ ` why: ${r.why}`,+ ` next step: ${r.next_step}`,+ ` who acts: ${r.actor}${r.effects.length ? ` · consent: ${r.effects.join(', ')}` : ''}`,+ ` verify: ${r.verify}`,+ ...(r.legacy_error ? [` legacy: some surfaces keep error: "${r.legacy_error}" with code: "${r.code}"`] : []),+ ...(r.reasons?.length ? [` reasons: ${r.reasons.join(', ')}`] : []),+ ` docs: ${docsUrl(r.docs)}`,+ ].join('\n');+}++/** The whole generated guide. Deterministic: sorted by code. */+export function renderErrorCodesMarkdown(): string {+ const rows = (Object.keys(CODES) as string[]).sort().map(c => errorCodeRow(c)!);+ const out: string[] = [+ '<!-- GENERATED by `bun run build:error-codes` from src/core/error-registry.ts. Do not edit by hand. -->',+ '# Error codes',+ '',+ 'Every gbrain error carries a stable `code`. Read `code` first and fall back to `error`',+ '(older servers send only `error`); then follow `fix.next` as described in',+ '[AGENT_OPERATOR_v1](../protocol/AGENT_OPERATOR_v1.md). Exit codes are in [exit codes](exit-codes.md).',+ 'Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the renamed codes.',+ '',+ '**Say to your agent:** *"gbrain returned an error code I don\'t recognize. Look it up and tell me what to do."*',+ '',+ '## Renamed in this release',+ '',+ 'Under contract v1 an existing `error` value never changes. Where a surface historically sent a',+ 'different value, it keeps sending it in `error` and adds the canonical value in `code`.',+ '',+ '| `error` (frozen) | `code` (canonical) | Meaning |',+ '|---|---|---|',+ ...changedCodeRows().map(r => `| \`${r.legacy_error ?? r.renamed_from}\` | \`${r.code}\` | ${cell(r.meaning)} |`),+ '',+ '## Codes',+ '',+ ];+ for (const r of rows) {+ out.push(`### ${r.code}`, '', `<a id="${r.code}"></a>`, '');+ out.push('| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable |');+ out.push('|---|---|---|---|---|---|---|');+ out.push(`| ${cell(r.meaning)} | ${cell(r.why)} | ${cell(r.next_step)} | ${r.actor}${r.effects.length ? ` · ${r.effects.join(', ')}` : ''} | \`${cell(r.verify)}\` | ${r.exit_code} | ${r.retryable ? 'yes' : 'no'} |`);+ if (r.reasons?.length) out.push('', `Reasons: ${r.reasons.map(x => `\`${x}\``).join(', ')}.`);+ if (r.docs !== `docs/guides/error-codes.md#${r.code}`) out.push('', `More: [${r.docs}](../../${r.docs})`);+ out.push('');+ }+ return `${out.join('\n').trimEnd()}\n`;+}diff --git a/test/error-catalogue.test.ts b/test/error-catalogue.test.tsindex a5ee5d977d..e176c364d9 100644--- a/test/error-catalogue.test.ts+++ b/test/error-catalogue.test.ts@@ -67,3 +67,60 @@ describe('catalogue refusals on the wire', () => {hint: 'gbrain jobs authorize-legacy --select "status=waiting"', docs_url: 'docs/guides/repair.md#legacy-job-selection-invalid' });});});++// ---------------------------------------------------------------------------+// Agent operator contract v1 (A2): the registry is complete and every anchor+// resolves. The AST walk is the scanner's own collector, so the CI guard and+// this test cannot disagree about what counts as a thrown code.+// ---------------------------------------------------------------------------++describe('error code registry (agent contract v1)', () => {+ test('every literal code thrown in src/ is registered', async () => {+ const ts = (await import('typescript')).default;+ const { collectThrownCodes } = await import('../scripts/check-agent-contract.ts');+ const { CODES } = await import('../src/core/error-catalogue.ts');+ const { readdirSync, statSync } = await import('node:fs');+ const walk = (d: string): string[] => readdirSync(d).flatMap(e => {+ const f = join(d, e);+ return statSync(f).isDirectory() ? walk(f) : e.endsWith('.ts') && !e.endsWith('.generated.ts') ? [f] : [];+ });+ const missing: string[] = [];+ let seen = 0;+ for (const file of walk(join(ROOT, 'src'))) {+ const sf = ts.createSourceFile(file, readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true);+ for (const { code, line } of collectThrownCodes(sf)) {+ seen++;+ if (!(code in CODES)) missing.push(`${file.slice(ROOT.length + 1)}:${line} ${code}`);+ }+ }+ expect(seen).toBeGreaterThan(1000);+ expect(missing).toEqual([]);+ });++ test('the collector sees conditional and StructuredError literals', async () => {+ const ts = (await import('typescript')).default;+ const { collectThrownCodes } = await import('../scripts/check-agent-contract.ts');+ const sf = ts.createSourceFile('x.ts', `new OperationError(a ? 'one' : 'two', 'm'); errorFor({ class: 'C', code: 'three', message: 'm' }); opError('four', 'm', 's');`, ts.ScriptTarget.Latest, true);+ expect(collectThrownCodes(sf).map(c => c.code)).toEqual(['one', 'two', 'three', 'four']);+ });++ test('every registry docs anchor resolves', async () => {+ const { CODES, codeEntry } = await import('../src/core/error-catalogue.ts');+ const unresolved: string[] = [];+ for (const code of Object.keys(CODES)) {+ const [path, anchor] = codeEntry(code)!.docs.split('#');+ if (!anchorsOf(path!).has(anchor!)) unresolved.push(`${code} → ${path}#${anchor}`);+ }+ expect(unresolved).toEqual([]);+ });++ test('codes are snake_case with no transport prefix', async () => {+ const { CODES } = await import('../src/core/error-catalogue.ts');+ expect(Object.keys(CODES).filter(c => !/^[a-z][a-z0-9_]*$/.test(c) || /^(mcp|http|cli|stdio)_/.test(c))).toEqual([]);+ });++ test('docs/guides/error-codes.md is fresh (bun run build:error-codes)', async () => {+ const { renderErrorCodesMarkdown } = await import('../src/core/error-docs.ts');+ expect(readFileSync(join(ROOT, 'docs/guides/error-codes.md'), 'utf8')).toBe(renderErrorCodesMarkdown());+ });+});diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/ops/sample.tsnew file mode 100644index 0000000000..1571b57e55--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-advice-key/src/core/ops/sample.ts@@ -0,0 +1 @@+export const r = { next_action: 'do the thing' };diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/error-registry.tsnew file mode 100644index 0000000000..21f07c7488--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/error-registry.ts@@ -0,0 +1,4 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+ mcp_bad_code: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/ops/sample.tsnew file mode 100644index 0000000000..ad1d380d6c--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-code-naming/src/core/ops/sample.ts@@ -0,0 +1 @@+export const x = 1;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/ops/sample.tsnew file mode 100644index 0000000000..0adf570260--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-hand-built/src/core/ops/sample.ts@@ -0,0 +1 @@+export const r = { fix: 'gbrain doctor --json' };diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/ops/sample.tsnew file mode 100644index 0000000000..5eae939cb6--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-interactive-io/src/core/ops/sample.ts@@ -0,0 +1,2 @@+import { createInterface } from 'node:readline';+export const rl = createInterface({ input: process.stdin });diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/ops/sample.tsnew file mode 100644index 0000000000..b87bc30304--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-marker/src/core/ops/sample.ts@@ -0,0 +1 @@+export const block = '[AGENT] ask: confirm [/AGENT]';diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/ops/sample.tsnew file mode 100644index 0000000000..5519a2c09f--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-stdio-inherit/src/core/ops/sample.ts@@ -0,0 +1,2 @@+import { spawn } from 'node:child_process';+export const c = () => spawn('ls', [], { stdio: 'inherit' });diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/ops/sample.tsnew file mode 100644index 0000000000..70e72e99d0--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-suggestionless/src/core/ops/sample.ts@@ -0,0 +1,2 @@+declare class OperationError extends Error { constructor(...args: unknown[]); }+export function f() { throw new OperationError('invalid_params', 'Bad input.'); }diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/ops/sample.tsnew file mode 100644index 0000000000..be0aefba79--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-throw-in-ops/src/core/ops/sample.ts@@ -0,0 +1 @@+export function f() { throw new Error('boom'); }diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/ops/sample.tsnew file mode 100644index 0000000000..2a1b8278ed--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-verify/src/core/ops/sample.ts@@ -0,0 +1 @@+export const fix = { argv: ['gbrain', 'doctor'], verify: { argv: ['gbrain', 'sync', '--all'] } };diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/ops/sample.tsnew file mode 100644index 0000000000..72a6f70f2a--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad-yes-rerun/src/core/ops/sample.ts@@ -0,0 +1 @@+export const msg = 'Refused. Re-run with --yes to proceed.';diff --git a/test/fixtures/guards/check-agent-contract.ts/bad/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/bad/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/bad/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/bad/src/core/ops/sample.tsnew file mode 100644index 0000000000..f8ab1c1d0d--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/bad/src/core/ops/sample.ts@@ -0,0 +1,2 @@+declare function opError(...args: unknown[]): Error;+export function f() { throw opError('not_registered_anywhere', 'Bad.', 'Fix it.'); }diff --git a/test/fixtures/guards/check-agent-contract.ts/good/src/core/error-registry.ts b/test/fixtures/guards/check-agent-contract.ts/good/src/core/error-registry.tsnew file mode 100644index 0000000000..b70481c8a7--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/good/src/core/error-registry.ts@@ -0,0 +1,3 @@+export const CODES = {+ invalid_params: { class: 'caller', summary: 'x' },+} as const;diff --git a/test/fixtures/guards/check-agent-contract.ts/good/src/core/ops/sample.ts b/test/fixtures/guards/check-agent-contract.ts/good/src/core/ops/sample.tsnew file mode 100644index 0000000000..2b1322857c--- /dev/null+++ b/test/fixtures/guards/check-agent-contract.ts/good/src/core/ops/sample.ts@@ -0,0 +1,2 @@+declare function opError(...args: unknown[]): Error;+export function f() { throw opError('invalid_params', 'Bad input.', 'Pass a slug.', { fix: { argv: ['gbrain', 'doctor', '--json'], consent: [], actor: 'agent', why: 'w', requires_exclusive: false, verify: { argv: ['gbrain', 'doctor', '--json'] } } }); }