claude-dev-env 1.94.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_shared/advisor/CLAUDE.md +2 -2
- package/_shared/advisor/advisor-protocol.md +41 -33
- package/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py +17 -13
- package/_shared/advisor/scripts/model_tier_run_validator.py +27 -18
- package/_shared/advisor/scripts/tests/test_model_tier_run_validator.py +95 -25
- package/_shared/advisor/scripts/tests/test_tier_model_ids.py +17 -17
- package/_shared/advisor/scripts/tier_model_ids.py +18 -18
- package/_shared/pr-loop/CLAUDE.md +1 -0
- package/_shared/pr-loop/scripts/CLAUDE.md +2 -1
- package/_shared/pr-loop/scripts/README.md +1 -0
- package/_shared/pr-loop/scripts/code_rules_gate.py +253 -1980
- package/_shared/pr-loop/scripts/code_rules_gate_parts/CLAUDE.md +32 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/__init__.py +7 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/added_line_maps.py +268 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/enforcer_loading.py +172 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/gate_arguments.py +70 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/gate_running.py +326 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/git_blob_readers.py +85 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/git_file_sets.py +331 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/staged_test_running.py +369 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/conftest.py +14 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_added_line_maps.py +118 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_enforcer_loading.py +17 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_gate_arguments.py +29 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_gate_running.py +99 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_git_blob_readers.py +69 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_git_file_sets.py +137 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_staged_test_running.py +116 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_violation_scoping.py +75 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/tests/test_wrapper_plumb_check.py +49 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/violation_scoping.py +328 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/wrapper_plumb_check.py +206 -0
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/code_rules_gate_constants.py +24 -17
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/reviews_disabled_constants.py +1 -0
- package/_shared/pr-loop/scripts/reviews_disabled.py +19 -2
- package/_shared/pr-loop/scripts/test_code_rules_gate.py +278 -0
- package/_shared/pr-loop/scripts/tests/test_code_rules_gate_constants.py +6 -39
- package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +43 -0
- package/_shared/pr-loop/worker-spawn.md +186 -0
- package/agents/code-verifier.md +1 -1
- package/bin/CLAUDE.md +10 -1
- package/bin/ever-shipped-skills.mjs +73 -0
- package/bin/expand_home_directory_tokens.mjs +1 -1
- package/bin/install.mjs +140 -7
- package/bin/install.prune.test.mjs +457 -0
- package/docs/CODE_RULES.md +1 -1
- package/hooks/advisory/refactor_guard.py +3 -4
- package/hooks/blocking/CLAUDE.md +7 -1
- package/hooks/blocking/block_main_commit.py +2 -2
- package/hooks/blocking/claude_md_orphan_file_blocker.py +75 -699
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/CLAUDE.md +28 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/__init__.py +1 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/config/__init__.py +1 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/config/orphan_blocker_constants.py +18 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/decision.py +81 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/references.py +307 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/scan_plan.py +124 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/subtree_scan.py +179 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/tests/conftest.py +10 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/tests/test_decision.py +34 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/tests/test_references.py +42 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/tests/test_scan_plan.py +27 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/tests/test_subtree_scan.py +30 -0
- package/hooks/blocking/code_rules_boolean_mustcheck.py +1 -1
- package/hooks/blocking/code_rules_enforcer.py +4 -0
- package/hooks/blocking/code_rules_mock_completeness.py +1 -1
- package/hooks/blocking/code_rules_optional_params.py +2 -2
- package/hooks/blocking/code_rules_shared.py +83 -1
- package/hooks/blocking/code_rules_test_assertions.py +1 -1
- package/hooks/blocking/code_rules_test_layout.py +9 -3
- package/hooks/blocking/code_rules_typeddict_stub.py +1 -1
- package/hooks/blocking/gh_pr_author_enforcer.py +1 -1
- package/hooks/blocking/inventory_intent_records/CLAUDE.md +26 -0
- package/hooks/blocking/inventory_intent_records/__init__.py +1 -0
- package/hooks/blocking/inventory_intent_records/config/__init__.py +1 -0
- package/hooks/blocking/inventory_intent_records/config/intent_records_constants.py +20 -0
- package/hooks/blocking/inventory_intent_records/records.py +271 -0
- package/hooks/blocking/inventory_intent_records/tests/conftest.py +10 -0
- package/hooks/blocking/inventory_intent_records/tests/test_records.py +80 -0
- package/hooks/blocking/package_inventory_stale_blocker.py +54 -384
- package/hooks/blocking/package_inventory_stale_blocker_parts/CLAUDE.md +26 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/__init__.py +1 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/config/__init__.py +1 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/config/inventory_blocker_constants.py +16 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/decision.py +84 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/inventory_detection.py +307 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/tests/conftest.py +10 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/tests/test_decision.py +38 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/tests/test_inventory_detection.py +61 -0
- package/hooks/blocking/pii_payload_scan.py +138 -42
- package/hooks/blocking/pii_prevention_blocker.py +185 -291
- package/hooks/blocking/pii_prevention_blocker_parts/CLAUDE.md +24 -0
- package/hooks/blocking/pii_prevention_blocker_parts/__init__.py +1 -0
- package/hooks/blocking/pii_prevention_blocker_parts/config/__init__.py +1 -0
- package/hooks/blocking/pii_prevention_blocker_parts/config/repository_resolution_constants.py +28 -0
- package/hooks/blocking/pii_prevention_blocker_parts/repository_exemption.py +214 -0
- package/hooks/blocking/pii_prevention_blocker_parts/repository_resolution.py +208 -0
- package/hooks/blocking/plain_language_blocker.py +138 -4
- package/hooks/blocking/pr_description_command_parser.py +8 -4
- package/hooks/blocking/precommit_code_rules_gate.py +3 -3
- package/hooks/blocking/sensitive_file_protector.py +114 -48
- package/hooks/blocking/tdd_enforcer.py +97 -601
- package/hooks/blocking/tdd_enforcer_parts/CLAUDE.md +30 -0
- package/hooks/blocking/tdd_enforcer_parts/__init__.py +1 -0
- package/hooks/blocking/tdd_enforcer_parts/candidate_paths.py +142 -0
- package/hooks/blocking/tdd_enforcer_parts/config/__init__.py +1 -0
- package/hooks/blocking/tdd_enforcer_parts/config/tdd_enforcer_constants.py +32 -0
- package/hooks/blocking/tdd_enforcer_parts/content_analysis.py +268 -0
- package/hooks/blocking/tdd_enforcer_parts/decisions.py +92 -0
- package/hooks/blocking/tdd_enforcer_parts/freshness.py +80 -0
- package/hooks/blocking/tdd_enforcer_parts/git_tracking.py +63 -0
- package/hooks/blocking/tdd_enforcer_parts/path_classification.py +119 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/conftest.py +10 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_candidate_paths.py +31 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_content_analysis.py +30 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_decisions.py +34 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_freshness.py +28 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_git_tracking.py +48 -0
- package/hooks/blocking/tdd_enforcer_parts/tests/test_path_classification.py +36 -0
- package/hooks/blocking/test_code_rules_enforcer_scratchpad.py +105 -0
- package/hooks/blocking/test_code_rules_shared.py +181 -0
- package/hooks/blocking/test_inventory_deadlock_resolution.py +154 -0
- package/hooks/blocking/test_pii_payload_scan.py +168 -0
- package/hooks/blocking/test_plain_language_blocker_allowlist.py +184 -0
- package/hooks/blocking/test_sensitive_file_protector.py +185 -0
- package/hooks/blocking/test_tdd_enforcer_restore.py +108 -0
- package/hooks/blocking/test_tdd_enforcer_scratchpad.py +105 -0
- package/hooks/blocking/tests/conftest.py +10 -0
- package/hooks/blocking/tests/test_pii_prevention_blocker.py +260 -0
- package/hooks/blocking/tests/test_repository_exemption.py +105 -0
- package/hooks/blocking/tests/test_repository_resolution.py +108 -0
- package/hooks/diagnostic/hook_log_extractor.py +12 -10
- package/hooks/git-hooks/post_commit.py +3 -4
- package/hooks/hooks_constants/CLAUDE.md +4 -2
- package/hooks/hooks_constants/banned_identifiers_constants.py +0 -1
- package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -1
- package/hooks/hooks_constants/harness_scratchpad_constants.py +17 -0
- package/hooks/hooks_constants/local_identity.py +59 -8
- package/hooks/hooks_constants/pii_prevention_constants.py +0 -6
- package/hooks/hooks_constants/plain_language_blocker_constants.py +5 -0
- package/hooks/hooks_constants/sensitive_file_protector_constants.py +42 -0
- package/hooks/hooks_constants/test_local_identity.py +105 -3
- package/hooks/pyproject.toml +52 -4
- package/hooks/session/plugin_data_dir_cleanup.py +0 -1
- package/hooks/validation/mypy_validator.py +2 -2
- package/hooks/validators/CLAUDE.md +1 -1
- package/hooks/validators/README.md +2 -0
- package/hooks/validators/health_check.py +1 -0
- package/hooks/validators/mypy_integration.py +2 -0
- package/hooks/validators/python_style_checks.py +114 -136
- package/hooks/validators/python_style_helpers.py +95 -0
- package/hooks/validators/ruff_integration.py +3 -0
- package/hooks/validators/test_python_style_checks.py +0 -164
- package/hooks/validators/test_python_style_checks_decorator_gap.py +119 -0
- package/hooks/validators/test_python_style_fixes.py +251 -0
- package/hooks/validators/test_python_style_helpers.py +125 -0
- package/hooks/workflow/auto_formatter.py +5 -4
- package/package.json +1 -1
- package/rules/CLAUDE.md +1 -0
- package/rules/anti-corollary-tests.md +69 -0
- package/rules/bdd.md +1 -3
- package/rules/code-reviews.md +1 -1
- package/rules/gh-paginate.md +1 -1
- package/rules/plain-language.md +2 -0
- package/scripts/CLAUDE.md +4 -0
- package/scripts/dev_env_scripts_constants/CLAUDE.md +6 -4
- package/scripts/dev_env_scripts_constants/code_review_constants.py +71 -0
- package/scripts/dev_env_scripts_constants/grok_worker_constants.py +435 -0
- package/scripts/dev_env_scripts_constants/timing.py +7 -1
- package/scripts/grok_headless_runner.py +294 -0
- package/scripts/grok_worker_preflight.py +410 -0
- package/scripts/invoke_code_review.py +463 -0
- package/scripts/resolve_worker_spawn.py +619 -0
- package/scripts/spawn_grok_batch.py +672 -0
- package/scripts/test_grok_headless_runner.py +626 -0
- package/scripts/test_grok_worker_preflight.py +1054 -0
- package/scripts/test_invoke_code_review.py +672 -0
- package/scripts/test_resolve_worker_spawn.py +1014 -0
- package/scripts/test_spawn_grok_batch.py +1017 -0
- package/skills/CLAUDE.md +6 -3
- package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +72 -13
- package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +121 -14
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/path_resolver_constants.py +78 -0
- package/skills/_shared/pr-loop/scripts/test_build_audit_prompt.py +121 -0
- package/skills/_shared/pr-loop/scripts/test_build_fix_prompt.py +196 -6
- package/skills/autoconverge/CLAUDE.md +3 -3
- package/skills/autoconverge/SKILL.md +9 -3
- package/skills/autoconverge/reference/CLAUDE.md +2 -2
- package/skills/autoconverge/reference/convergence.md +33 -11
- package/skills/autoconverge/reference/stop-conditions.md +16 -5
- package/skills/autoconverge/workflow/CLAUDE.md +2 -1
- package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +7 -2
- package/skills/autoconverge/workflow/converge.codex-gate.test.mjs +300 -0
- package/skills/autoconverge/workflow/converge.contract.test.mjs +5 -5
- package/skills/autoconverge/workflow/converge.copilot-gate.test.mjs +29 -29
- package/skills/autoconverge/workflow/converge.fix-progress.test.mjs +1 -1
- package/skills/autoconverge/workflow/converge.mjs +202 -18
- package/skills/bugteam/CLAUDE.md +2 -2
- package/skills/bugteam/CONSTRAINTS.md +3 -2
- package/skills/bugteam/PROMPTS.md +7 -6
- package/skills/bugteam/SKILL.md +18 -13
- package/skills/bugteam/reference/README.md +2 -3
- package/skills/bugteam/reference/audit-and-teammates.md +215 -35
- package/skills/bugteam/reference/design-rationale.md +1 -1
- package/skills/bugteam/reference/obstacles/CLAUDE.md +1 -1
- package/skills/bugteam/reference/team-setup.md +8 -2
- package/skills/closeout/SKILL.md +153 -0
- package/skills/closeout/reference/handoff-prompt-template.md +72 -0
- package/skills/closeout/reference/issue-body-templates.md +108 -0
- package/skills/closeout/reference/pii-redaction-checklist.md +36 -0
- package/skills/codex-review/CLAUDE.md +46 -0
- package/skills/codex-review/SKILL.md +181 -0
- package/skills/codex-review/reference/CLAUDE.md +15 -0
- package/skills/codex-review/reference/cli-contract.md +253 -0
- package/skills/codex-review/reference/loop-integration.md +118 -0
- package/skills/codex-review/scripts/codex_down_classifier.py +98 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/CLAUDE.md +18 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/__init__.py +1 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/classifier_constants.py +35 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/codex_usage_probe_constants.py +86 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/findings_constants.py +18 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/run_constants.py +45 -0
- package/skills/codex-review/scripts/codex_usage_probe.py +573 -0
- package/skills/codex-review/scripts/fixtures/auth_failure_synthetic.txt +1 -0
- package/skills/codex-review/scripts/fixtures/config_load_failure_v0.125.0.txt +1 -0
- package/skills/codex-review/scripts/fixtures/freeform_findings_v0.144.3.txt +6 -0
- package/skills/codex-review/scripts/fixtures/model_rejection_v0.125.0.jsonl +5 -0
- package/skills/codex-review/scripts/fixtures/structured_findings.txt +13 -0
- package/skills/codex-review/scripts/fixtures/success_stream_v0.144.3.jsonl +6 -0
- package/skills/codex-review/scripts/fixtures/unknown_failure_synthetic.txt +1 -0
- package/skills/codex-review/scripts/fixtures/usage_limit_synthetic.txt +1 -0
- package/skills/codex-review/scripts/parse_codex_findings.py +207 -0
- package/skills/codex-review/scripts/run_codex_review.py +415 -0
- package/skills/codex-review/scripts/test_codex_down_classifier.py +143 -0
- package/skills/codex-review/scripts/test_codex_usage_probe.py +678 -0
- package/skills/codex-review/scripts/test_parse_codex_findings.py +130 -0
- package/skills/codex-review/scripts/test_run_codex_review.py +812 -0
- package/skills/codex-review/test_skill_scaffold.py +192 -0
- package/skills/grok-spawn/CLAUDE.md +28 -0
- package/skills/grok-spawn/SKILL.md +226 -0
- package/skills/grok-spawn/reference/flag-profiles.md +132 -0
- package/skills/grok-spawn/reference/worker-briefs.md +152 -0
- package/skills/grokify/SKILL.md +9 -1
- package/skills/grokify/capability-claims.test.mjs +28 -0
- package/skills/grokify/evals/README.md +72 -0
- package/skills/grokify/evals/parse-payload.test.mjs +171 -0
- package/skills/grokify/evals/run-capability-evals.mjs +545 -0
- package/skills/orchestrator/SKILL.md +32 -22
- package/skills/orchestrator-refresh/SKILL.md +12 -8
- package/skills/pr-converge/CLAUDE.md +1 -1
- package/skills/pr-converge/SKILL.md +34 -13
- package/skills/pr-converge/reference/convergence-gates.md +42 -15
- package/skills/pr-converge/reference/fix-protocol.md +1 -1
- package/skills/pr-converge/reference/ground-rules.md +1 -1
- package/skills/pr-converge/reference/per-tick.md +130 -42
- package/skills/pr-converge/reference/state-schema.md +10 -0
- package/skills/pr-converge/scripts/CLAUDE.md +2 -0
- package/skills/pr-converge/scripts/_pr_converge_path_setup.py +5 -1
- package/skills/pr-converge/scripts/check_convergence.py +605 -29
- package/skills/pr-converge/scripts/check_convergence_availability.py +232 -0
- package/skills/pr-converge/scripts/check_convergence_gates.py +279 -235
- package/skills/pr-converge/scripts/check_convergence_thread_gates.py +1 -1
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/convergence_gate_constants.py +36 -2
- package/skills/pr-converge/scripts/test__pr_converge_path_setup.py +4 -0
- package/skills/pr-converge/scripts/test_check_convergence.py +71 -3
- package/skills/pr-converge/scripts/test_check_convergence_availability.py +326 -0
- package/skills/pr-converge/scripts/test_check_convergence_codex.py +507 -0
- package/skills/pr-converge/scripts/test_check_convergence_contract.py +89 -17
- package/skills/pr-converge/scripts/test_check_convergence_fixture.py +179 -0
- package/skills/pr-converge/scripts/test_check_convergence_gates.py +84 -68
- package/skills/pr-converge/scripts/test_check_convergence_thread_gates.py +24 -0
- package/skills/pr-converge/test_step5_host_branch.py +106 -0
- package/skills/pr-fix-protocol/SKILL.md +65 -0
- package/skills/pr-loop-cloud-transport/SKILL.md +2 -0
- package/skills/reviewer-gates/SKILL.md +7 -5
- package/skills/skill-builder/references/skill-modularity.md +1 -1
- package/skills/team-advisor/SKILL.md +16 -12
- package/system-prompts/software-engineer.xml +7 -6
- package/hooks/validators/test_verify_paths.py +0 -32
- package/hooks/validators/verify_paths.py +0 -57
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Warm-advisor bind-and-consult protocol shared by `team-advisor`, `orchestrator`, `orchestrator-refresh`, and every executor subagent `orchestrator` routes work to. Changes here affect all of these simultaneously — treat this as a breaking-change surface.
|
|
4
4
|
|
|
5
|
-
Host profile (Claude vs
|
|
5
|
+
Host profile (Claude vs third-party) is detected first; Claude walks the multi-tier Agent spawn ladder (CLI chain as fallback), a third-party host binds a max-tier Claude advisor through the CLI Claude-chain (fail closed when the chain cannot serve) with a separate executor paste block.
|
|
6
6
|
|
|
7
7
|
## Key documents
|
|
8
8
|
|
|
9
9
|
| File | Purpose |
|
|
10
10
|
|---|---|
|
|
11
|
-
| `advisor-protocol.md` | Host profiles first,
|
|
11
|
+
| `advisor-protocol.md` | Host profiles first, model floor, warm-up / CLI bind procedure and charter, consult format and cadence, lifecycle ownership (Agent spawn on Claude / CLI re-bind on a third-party host), host-matched Advisor blocks for executor spawns, and the shared CLI Claude-chain |
|
|
12
12
|
|
|
13
13
|
## Subdirectory
|
|
14
14
|
|
|
@@ -2,46 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
Shared spawn-once, consult-by-message protocol for a warm advisor. Two skills depend on this: `team-advisor` (binds the advisor for its own consulting session) and `orchestrator` (binds the same advisor and lets its own routed executor subagents consult it too). Executor spawn prompts are a third consumer, via the host-matched Advisor block below.
|
|
4
4
|
|
|
5
|
-
**First step of every bind:** detect the host profile (next section). Do not walk the model-floor ladder, spawn `session-advisor`, or open the CLI fallback until the host is known. On
|
|
5
|
+
**First step of every bind:** detect the host profile (next section). Do not walk the model-floor ladder, spawn `session-advisor`, or open the CLI fallback until the host is known. On a third-party host, skip straight to **Host profiles → Third-party host**. On Claude, continue with **Model floor** and the rest of this document.
|
|
6
6
|
|
|
7
7
|
## Host profiles
|
|
8
8
|
|
|
9
|
-
Detect the host profile **before** any model-floor walk. Source of truth for names and detection: `HOST_PROFILE_CLAUDE`, `
|
|
9
|
+
Detect the host profile **before** any model-floor walk. Source of truth for names and detection: `HOST_PROFILE_CLAUDE`, `HOST_PROFILE_THIRD_PARTY`, `ALL_HOST_PROFILES`, and `detect_host_profile(...)` in `$HOME/.claude/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py` and `tier_model_ids.py`.
|
|
10
10
|
|
|
11
11
|
Detection order:
|
|
12
12
|
|
|
13
|
-
1. `ADVISOR_HOST_PROFILE=
|
|
14
|
-
2. `
|
|
13
|
+
1. `ADVISOR_HOST_PROFILE=ThirdParty` or `=Claude` (explicit override; any letter case).
|
|
14
|
+
2. `THIRD_PARTY=1` (or `true` / `yes` / `on`) — a third-party (non-Claude) harness.
|
|
15
15
|
3. Default: Claude.
|
|
16
16
|
|
|
17
17
|
### Claude host
|
|
18
18
|
|
|
19
19
|
Use the **Model floor** ladder below (Fable → Opus → Sonnet → Haiku). Warm-up spawns `subagent_type: session-advisor` via the Agent tool; consults go through `SendMessage` to that warm agent. When every candidate down to the floor fails, take the CLI Claude-chain fallback. Paste the **Claude host** Advisor block into every executor spawn prompt.
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Third-party host
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
A third-party (non-Claude) harness cannot spawn a Claude `session-advisor` through the Agent tool. Bind a **max-tier Claude advisor** through the shared CLI Claude-chain (account usage failover). Do **not** treat this third-party session as the advisor.
|
|
24
24
|
|
|
25
25
|
1. Detect host profile first (this section).
|
|
26
|
-
2. Set
|
|
27
|
-
3. **
|
|
28
|
-
4. Record the single attempt as `{tier: "Grok", result: "self"}` — the `self` token marks a self-bind so logs stay honest (not a separate spawn).
|
|
29
|
-
5. CLI Claude-chain fallback does **not** apply on a pure Grok host.
|
|
30
|
-
6. Paste the **Grok host** Advisor block into every executor spawn prompt — never the Claude SendMessage block.
|
|
26
|
+
2. Set the advisor floor to **Opus** so the walk is `candidate_tiers = ["Fable", "Opus"]` with `own_tier = Opus`. The walk never drops to Sonnet or Haiku on a third-party host.
|
|
27
|
+
3. **CLI bind (primary path):** for each candidate top-down, pipe a charter file into:
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
```
|
|
30
|
+
python "$HOME/.claude/scripts/claude_chain_runner.py" -- -p --model <alias> --effort <effort> --output-format json
|
|
31
|
+
```
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
Use `--model fable --effort high` on Fable; use `--model opus --effort max` on Opus. The chain runner walks `~/.claude/claude-chain.json` (binaries such as `claude`, `claude-ev`, `claude-editor`, `claude-mel`) and fails over only on a usage-limit signature.
|
|
34
|
+
4. Stop at the first successful bind. Record `{tier, result: "cli"}` and set `selected_tier` to that tier. Persist `session_id` from the JSON events (any event carries it; reply text is the `type == "result"` event's `.result` field). Run every bind and every later consult with cwd set to the repo root the work is for — Claude sessions are project-scoped by working directory.
|
|
35
|
+
5. **Fail closed:** when every candidate fails (chain exhausted or model unavailable), set `selected_tier = null` and a `fallback_reason`, report that the advisor is unreachable, and **stop**. Do **not** answer ENDORSE / CORRECTION / PLAN / STOP as this third-party session. Do **not** self-endorse.
|
|
36
|
+
6. Paste the **Third-party host** Advisor block into every executor spawn prompt — never the Claude SendMessage block. Executors report to the orchestrating session; that session consults the bound Claude CLI advisor and relays the four-signal reply.
|
|
37
|
+
|
|
38
|
+
Resolve a third-party session's own model field with `resolve_cli_model_id("ThirdParty")` → `third-party` when a host model alias is required. The **advisor** bind uses Fable/Opus aliases only.
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
## Model floor
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
**Claude host:** the advisor's model tier must be at or above the highest tier of any consumer that will reach it. Each consuming skill supplies its own consumer set when computing the floor:
|
|
39
43
|
- `team-advisor`: the sole consumer is the calling session itself, so the floor is just that session's own tier.
|
|
40
44
|
- `orchestrator`: the consumer set is the orchestrating session plus every tier named in its routing table, so the floor is the max of those.
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
**Third-party host:** the CLI advisor floor is fixed at **Opus** (walk Fable → Opus only). The third-party session's own tier is not the advisor floor — see **Host profiles → Third-party host**.
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Ladder, strongest first (canonical Title Case names: `Fable`, `Opus`, `Sonnet`, `Haiku`; the validator accepts any letter case and normalizes to Title Case): Fable, Opus, Sonnet, Haiku. Read the floor tier — the lower bound only — then try binds top-down from Fable, stopping at the floor tier — never bind below it. On a Claude host each walk attempt sets the Agent tool `model:` field to the short alias for that attempt's candidate tier (`resolve_cli_model_id(candidate_tier)` — for example `opus`, not Title Case `Opus`). On a third-party host each walk attempt uses the CLI chain with that alias and the effort flags in **Host profiles → Third-party host**. The advisor is created at `selected_tier` (the first ladder tier that actually bound), which may sit above the floor. If even the floor tier fails on a Claude host, move to the CLI fallback below; on a third-party host the CLI chain **is** the primary path, so floor failure is fail-closed (report unreachable).
|
|
49
|
+
|
|
50
|
+
Emit a structured spawn-walk log so it can be checked mechanically rather than inferred from a transcript. Record: `own_tier` (the floor tier), `candidate_tiers` (the ladder slice down to that floor), `attempts` (one `{tier, result}` entry appended as each bind try happens, `result` one of `spawned` for a Claude Agent spawn, `cli` for a CLI Claude-chain bind, or a failure reason such as `unavailable`), and `selected_tier` (the tier of the first successful bind — first `spawned` or `cli` entry — or `null` paired with a `fallback_reason` string when none bound). Write the log as JSON with those field names to a path the session controls — typically `<job-temp-dir>/model-tier-run.json` (or the OS temp directory when no job directory exists). Check it with:
|
|
45
51
|
|
|
46
52
|
```
|
|
47
53
|
python "$HOME/.claude/_shared/advisor/scripts/model_tier_run_validator.py" <path-to-model-tier-run.json>
|
|
@@ -49,15 +55,15 @@ python "$HOME/.claude/_shared/advisor/scripts/model_tier_run_validator.py" <path
|
|
|
49
55
|
|
|
50
56
|
Exit code `0` means every invariant holds; `1` means a ladder invariant failed; `2` means the path or JSON was unusable. The same checks are available in-process via `validate_model_tier_run(run)`.
|
|
51
57
|
|
|
52
|
-
The validator checks ladder shape only (candidate slice, attempt order, success-token rules per tier).
|
|
58
|
+
The validator checks ladder shape only (candidate slice, attempt order, success-token rules per tier). Host policy on top: a third-party host with `selected_tier=null` after an exhausted Fable→Opus walk must fail closed (report unreachable; never self-endorse).
|
|
53
59
|
|
|
54
60
|
## Warm-up (once per session)
|
|
55
61
|
|
|
56
|
-
On a
|
|
62
|
+
On a **third-party host**, follow **Host profiles → Third-party host** (CLI Claude-chain bind at Fable then Opus; no Agent-tool `session-advisor` spawn). Charter the CLI session as a standing reviewer that only answers with ENDORSE / CORRECTION / PLAN / STOP — same consult contract as the Agent path, without SendMessage.
|
|
57
63
|
|
|
58
|
-
On a Claude host
|
|
64
|
+
On a **Claude host**, the consuming skill's session walks the candidate tiers top-down. For each attempt, spawn with:
|
|
59
65
|
- `subagent_type: session-advisor` (see [`agents/session-advisor.md`](../../agents/session-advisor.md) for the full signal contract).
|
|
60
|
-
- `model`: the short alias for that attempt's candidate tier via `resolve_cli_model_id` (or the alias table under
|
|
66
|
+
- `model`: the short alias for that attempt's candidate tier via `resolve_cli_model_id` (or the alias table under CLI chain) — for example `opus`, not Title Case `Opus`. The floor is only the lower bound of the walk; the walk still tries stronger tiers first.
|
|
61
67
|
- `name`: a name the session and every consumer will use to reach it (e.g. `team-advisor-agent`).
|
|
62
68
|
- `run_in_background: true`.
|
|
63
69
|
|
|
@@ -86,7 +92,7 @@ Each consult carries, in order: who you are and your assignment (only needed on
|
|
|
86
92
|
|
|
87
93
|
**Report-back rule.** After a CORRECTION or PLAN, your next consult on that topic opens with what happened when you followed it.
|
|
88
94
|
|
|
89
|
-
Treat the reply as a serious second opinion: a CORRECTION — whether it names a wrong step or a risk worth closing — is something to address before treating the plan or the work as done. A STOP, or a consult that finds the advisor unreachable, is reported up rather than retried — team-advisor's sole consumer is the session itself, so it reports to the user; orchestrator's executors report to the orchestrating session, which decides. When the advisor becomes unreachable, report that to the session that owns its lifecycle (see below); that session alone decides whether to respawn (Claude
|
|
95
|
+
Treat the reply as a serious second opinion: a CORRECTION — whether it names a wrong step or a risk worth closing — is something to address before treating the plan or the work as done. A STOP, or a consult that finds the advisor unreachable, is reported up rather than retried — team-advisor's sole consumer is the session itself, so it reports to the user; orchestrator's executors report to the orchestrating session, which decides. When the advisor becomes unreachable, report that to the session that owns its lifecycle (see below); that session alone decides whether to respawn (Claude Agent or third-party CLI re-bind). A third-party host that cannot re-bind fails closed and reports to the user — it does not answer the four signals as itself.
|
|
90
96
|
|
|
91
97
|
## Advisor block — paste the host-matched block into every executor spawn prompt
|
|
92
98
|
|
|
@@ -96,9 +102,9 @@ Each paragraph is self-contained — the executor receives only this text, not t
|
|
|
96
102
|
|
|
97
103
|
> A shared session advisor named `<name>` is reachable via SendMessage. Consult it before locking in a nontrivial approach, once you believe your assignment is done, before any hard-to-reverse action, when the same failure repeats or progress has stalled, and when the chosen approach is being reconsidered. Open each consult with who you are and your assignment, then: what you tried, the exact decision or blocker, and relevant paths or excerpts. Re-raise something it already answered only when you have new evidence to attach — the result of trying its advice, fresh output, or a changed constraint; otherwise act on its standing answer. After a CORRECTION or PLAN, your next consult on that topic opens with what happened when you followed it. Its replies open with one of ENDORSE, CORRECTION, PLAN, or STOP — treat CORRECTION and PLAN as actions to take. On STOP, or if the advisor is unreachable, report that back to whoever assigned you and leave lifecycle decisions to the session that owns the advisor.
|
|
98
104
|
|
|
99
|
-
###
|
|
105
|
+
### Third-party host (Claude CLI advisor; report to orchestrating session)
|
|
100
106
|
|
|
101
|
-
> The orchestrating session
|
|
107
|
+
> The orchestrating session owns a standing **Claude** advisor bound through the CLI Claude-chain (max tier: Fable high, then Opus max). There is no Agent-tool `session-advisor` and no SendMessage path to one. Report blockers and hard decisions to the **orchestrating session** (the session that assigned you) before locking in a nontrivial approach, once you believe your assignment is done, before any hard-to-reverse action, when the same failure repeats or progress has stalled, and when the chosen approach is being reconsidered. Open each report with who you are and your assignment, then: what you tried, the exact decision or blocker, and relevant paths or excerpts. Re-raise something already answered only when you have new evidence to attach — the result of trying prior advice, fresh output, or a changed constraint; otherwise act on the standing answer. After a CORRECTION or PLAN, your next report on that topic opens with what happened when you followed it. The orchestrating session consults the Claude CLI advisor and relays one of ENDORSE, CORRECTION, PLAN, or STOP — treat CORRECTION and PLAN as actions to take. On STOP, or if the orchestrating session reports the advisor unreachable, stop work and surface that upward; do not spawn a `session-advisor` agent yourself, and do not treat the third-party orchestrator's own judgment as an advisor signal.
|
|
102
108
|
|
|
103
109
|
## Lifecycle ownership
|
|
104
110
|
|
|
@@ -108,17 +114,19 @@ The session that spawns the shared advisor owns its whole lifecycle — spawn, d
|
|
|
108
114
|
|
|
109
115
|
**Re-spawn on drift.** If a reply shows the agent working from a stale picture, or the session pivots to an unrelated task, the owning session ends that agent and spawns a fresh one with a new charter, rather than forcing the old context to stretch across two different jobs.
|
|
110
116
|
|
|
111
|
-
###
|
|
117
|
+
### Third-party host
|
|
118
|
+
|
|
119
|
+
The orchestrating session owns the Claude CLI advisor bind for the whole run — first bind, re-bind on drift or lost `session_id`, and fail-closed report when the chain cannot serve.
|
|
112
120
|
|
|
113
|
-
|
|
121
|
+
**Re-bind on drift.** If a reply shows a stale picture, the task pivots, or `--resume` fails after a usage-limit failover (session stores are per binary/account), re-bind through `claude_chain_runner.py` with the charter plus a compact recap of consults so far, capture the new `session_id`, and log a fresh Fable→Opus walk with `result: "cli"` on success. Executors keep reporting to the orchestrating session; they never bind a replacement advisor themselves.
|
|
114
122
|
|
|
115
|
-
|
|
123
|
+
## CLI chain
|
|
116
124
|
|
|
117
|
-
|
|
125
|
+
The shared runner is `python "$HOME/.claude/scripts/claude_chain_runner.py" -- <claude args...>`. It walks `~/.claude/claude-chain.json` and fails over to the next binary only on a usage-limit signature, so a usage-limited primary account still gets served.
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
**Third-party host:** this runner is the **primary** advisor bind and consult path (see **Host profiles → Third-party host**). Map each walk attempt to `--model <alias>` and the effort flags there. When the walk exhausts, fail closed.
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
**Claude host:** fall back to this runner when any of these holds, rather than on judgment call:
|
|
122
130
|
- The Agent-tool spawn errors at every candidate tier down to the floor — the tool itself, not just the top tier, is unavailable.
|
|
123
131
|
- `SendMessage` to the shared advisor errors, or draws no reply within the bound in `ADVISOR_SENDMESSAGE_REPLY_WAIT_SECONDS` (120) in `$HOME/.claude/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py`, and a re-spawn also fails.
|
|
124
132
|
- The running session is itself a subagent barred from spawning further agents.
|
|
@@ -131,11 +139,11 @@ Map `selected_tier` when one exists (the warm agent already bound above the floo
|
|
|
131
139
|
| Opus | `opus` |
|
|
132
140
|
| Sonnet | `sonnet` |
|
|
133
141
|
| Haiku | `haiku` |
|
|
134
|
-
|
|
|
142
|
+
| ThirdParty (third-party session model field only; not an advisor walk tier) | `third-party` |
|
|
135
143
|
|
|
136
|
-
Resolve in code with `python -c "from tier_model_ids import resolve_cli_model_id; print(resolve_cli_model_id('Opus'))"` from `$HOME/.claude/_shared/advisor/scripts/` (any letter case accepted; unknown tiers raise `ValueError`).
|
|
144
|
+
Resolve in code with `python -c "from tier_model_ids import resolve_cli_model_id; print(resolve_cli_model_id('Opus'))"` from `$HOME/.claude/_shared/advisor/scripts/` (any letter case accepted; unknown tiers raise `ValueError`). Write the charter or the consult brief to a temporary file under the job's own temporary directory (or the OS temp directory when no job directory exists) and pipe it in, rather than passing either as an inline argument, and drop that file once the consult completes.
|
|
137
145
|
|
|
138
|
-
Read the `session_id` out of the first call's JSON
|
|
146
|
+
Read the `session_id` out of the first call's JSON events and pass it to `-p --resume <session_id> --output-format json` on every later consult — `-p` stays on the resume call too, since it is still a non-interactive invocation. A usage-limit failover to the next binary in the chain does not carry the `session_id` forward: a session store belongs to the binary and account that minted it, so a `--resume` against the new binary can fail. Treat that failure as starting over, not as an error to retry — resend the charter plus a compact recap of the consults since the last one, capture the new `session_id` the fresh call returns, and continue from there.
|
|
139
147
|
|
|
140
148
|
## Mechanism, not a measured saving
|
|
141
149
|
|
|
@@ -9,28 +9,32 @@ that mark a bind.
|
|
|
9
9
|
attempt = {"tier": "Opus", "result": "spawned"}
|
|
10
10
|
^^^^^^ ^^^^^^^^^
|
|
11
11
|
a ladder tier SPAWN_SUCCESS_TOKEN
|
|
12
|
-
ok: "
|
|
12
|
+
ok: "cli" marks a CLI Claude-chain bind (CLI_BIND_SUCCESS_TOKEN)
|
|
13
13
|
flag: any other result token counts as no bind
|
|
14
14
|
|
|
15
15
|
The alias map turns each tier into its short CLI / Agent name (``opus``,
|
|
16
|
-
``
|
|
16
|
+
``third-party``), never a dated full model ID.
|
|
17
17
|
|
|
18
18
|
Host-profile detection (see ``detect_host_profile``):
|
|
19
19
|
|
|
20
|
-
- ``ADVISOR_HOST_PROFILE=
|
|
21
|
-
- ``
|
|
20
|
+
- ``ADVISOR_HOST_PROFILE=ThirdParty`` or ``=Claude`` — explicit override
|
|
21
|
+
- ``THIRD_PARTY=1`` (or ``true`` / ``yes``) — a third-party (non-Claude) harness
|
|
22
22
|
- default when neither is set: Claude
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
from __future__ import annotations
|
|
26
26
|
|
|
27
27
|
HOST_PROFILE_CLAUDE: str = "Claude"
|
|
28
|
-
|
|
29
|
-
ALL_HOST_PROFILES: tuple[str, ...] = (
|
|
28
|
+
HOST_PROFILE_THIRD_PARTY: str = "ThirdParty"
|
|
29
|
+
ALL_HOST_PROFILES: tuple[str, ...] = (
|
|
30
|
+
HOST_PROFILE_CLAUDE,
|
|
31
|
+
HOST_PROFILE_THIRD_PARTY,
|
|
32
|
+
)
|
|
30
33
|
|
|
31
34
|
ALL_MODEL_TIERS: tuple[str, ...] = ("Fable", "Opus", "Sonnet", "Haiku")
|
|
32
|
-
|
|
33
|
-
ALL_KNOWN_TIER_NAMES: tuple[str, ...] = (*ALL_MODEL_TIERS,
|
|
35
|
+
THIRD_PARTY_MODEL_TIER: str = "ThirdParty"
|
|
36
|
+
ALL_KNOWN_TIER_NAMES: tuple[str, ...] = (*ALL_MODEL_TIERS, THIRD_PARTY_MODEL_TIER)
|
|
37
|
+
THIRD_PARTY_CLI_ADVISOR_FLOOR_TIER: str = "Opus"
|
|
34
38
|
|
|
35
39
|
ADVISOR_SENDMESSAGE_REPLY_WAIT_SECONDS: int = 120
|
|
36
40
|
|
|
@@ -39,19 +43,19 @@ ALL_CLI_MODEL_ID_BY_TIER: dict[str, str] = {
|
|
|
39
43
|
"Opus": "opus",
|
|
40
44
|
"Sonnet": "sonnet",
|
|
41
45
|
"Haiku": "haiku",
|
|
42
|
-
|
|
46
|
+
THIRD_PARTY_MODEL_TIER: "third-party",
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
HOST_PROFILE_ENV_VAR: str = "ADVISOR_HOST_PROFILE"
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
THIRD_PARTY_ENV_VAR: str = "THIRD_PARTY"
|
|
51
|
+
ALL_THIRD_PARTY_TRUTHY_VALUES: frozenset[str] = frozenset(
|
|
48
52
|
{"1", "true", "yes", "on"}
|
|
49
53
|
)
|
|
50
54
|
|
|
51
55
|
TIER_KEY: str = "tier"
|
|
52
56
|
SPAWN_OUTCOME_KEY: str = "result"
|
|
53
57
|
SPAWN_SUCCESS_TOKEN: str = "spawned"
|
|
54
|
-
|
|
58
|
+
CLI_BIND_SUCCESS_TOKEN: str = "cli"
|
|
55
59
|
|
|
56
60
|
UNKNOWN_OWN_TIER_MESSAGE: str = "own_tier is not a known model tier"
|
|
57
61
|
UNKNOWN_LADDER_NAME_ERROR: str = "ladder name is not a known model tier: {!r}"
|
|
@@ -66,7 +70,7 @@ ATTEMPT_ORDER_MISMATCH_MESSAGE: str = (
|
|
|
66
70
|
"spawn tries do not walk the candidate tiers in ladder order"
|
|
67
71
|
)
|
|
68
72
|
SELECTED_TIER_MISMATCH_MESSAGE: str = (
|
|
69
|
-
"selected_tier does not match the first successful bind (spawned or
|
|
73
|
+
"selected_tier does not match the first successful bind (spawned or cli)"
|
|
70
74
|
)
|
|
71
75
|
SELECTED_TIER_NOT_NULL_MESSAGE: str = (
|
|
72
76
|
"selected_tier must be null when no spawn try succeeded"
|
|
@@ -17,13 +17,13 @@ from data, not inferred from a transcript.
|
|
|
17
17
|
)
|
|
18
18
|
validate_model_tier_run(ladder_walk) # ok: returns None, raises nothing
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
own_tier="
|
|
22
|
-
candidate_tiers=["
|
|
23
|
-
attempts=[{"tier": "
|
|
24
|
-
selected_tier="
|
|
20
|
+
cli_bind = ModelTierRun(
|
|
21
|
+
own_tier="Opus",
|
|
22
|
+
candidate_tiers=["Fable", "Opus"],
|
|
23
|
+
attempts=[{"tier": "Fable", "result": "cli"}],
|
|
24
|
+
selected_tier="Fable",
|
|
25
25
|
)
|
|
26
|
-
validate_model_tier_run(
|
|
26
|
+
validate_model_tier_run(cli_bind) # ok: third-party-host CLI Claude-chain bind
|
|
27
27
|
|
|
28
28
|
A run whose selected_tier is not the first successful bind fails.
|
|
29
29
|
On any broken invariant, validate_model_tier_run raises ModelTierRunError.
|
|
@@ -52,19 +52,20 @@ from advisor_scripts_constants.model_tier_run_validator_constants import ( # no
|
|
|
52
52
|
ATTEMPT_ORDER_MISMATCH_MESSAGE,
|
|
53
53
|
ATTEMPT_TIER_OUT_OF_SLICE_MESSAGE,
|
|
54
54
|
CANDIDATE_TIERS_MISMATCH_MESSAGE,
|
|
55
|
+
CLI_BIND_SUCCESS_TOKEN,
|
|
55
56
|
CLI_INVALID_JSON_EXIT_CODE,
|
|
56
57
|
CLI_MISSING_PATH_EXIT_CODE,
|
|
57
58
|
CLI_SUCCESS_EXIT_CODE,
|
|
58
59
|
CLI_USAGE_MESSAGE,
|
|
59
60
|
CLI_VALIDATION_FAILURE_EXIT_CODE,
|
|
60
|
-
GROK_MODEL_TIER,
|
|
61
61
|
INCOMPLETE_FALLBACK_WALK_MESSAGE,
|
|
62
62
|
MISSING_FALLBACK_REASON_MESSAGE,
|
|
63
63
|
SELECTED_TIER_MISMATCH_MESSAGE,
|
|
64
64
|
SELECTED_TIER_NOT_NULL_MESSAGE,
|
|
65
|
-
SELF_BIND_SUCCESS_TOKEN,
|
|
66
65
|
SPAWN_OUTCOME_KEY,
|
|
67
66
|
SPAWN_SUCCESS_TOKEN,
|
|
67
|
+
THIRD_PARTY_CLI_ADVISOR_FLOOR_TIER,
|
|
68
|
+
THIRD_PARTY_MODEL_TIER,
|
|
68
69
|
TIER_KEY,
|
|
69
70
|
UNKNOWN_OWN_TIER_MESSAGE,
|
|
70
71
|
)
|
|
@@ -98,8 +99,9 @@ def _expected_candidate_tiers(own_tier: str) -> list[str]:
|
|
|
98
99
|
maybe_canonical_own_tier = canonical_tier_name(own_tier)
|
|
99
100
|
if maybe_canonical_own_tier is None:
|
|
100
101
|
raise ModelTierRunError(f"{UNKNOWN_OWN_TIER_MESSAGE}: {own_tier!r}")
|
|
101
|
-
if maybe_canonical_own_tier ==
|
|
102
|
-
|
|
102
|
+
if maybe_canonical_own_tier == THIRD_PARTY_MODEL_TIER:
|
|
103
|
+
floor_index = ALL_MODEL_TIERS.index(THIRD_PARTY_CLI_ADVISOR_FLOOR_TIER)
|
|
104
|
+
return list(ALL_MODEL_TIERS[: floor_index + 1])
|
|
103
105
|
floor_index = ALL_MODEL_TIERS.index(maybe_canonical_own_tier)
|
|
104
106
|
return list(ALL_MODEL_TIERS[: floor_index + 1])
|
|
105
107
|
|
|
@@ -108,9 +110,13 @@ def _is_successful_attempt_outcome(
|
|
|
108
110
|
canonical_tier: str,
|
|
109
111
|
outcome_token: str,
|
|
110
112
|
) -> bool:
|
|
111
|
-
if canonical_tier ==
|
|
112
|
-
return
|
|
113
|
-
|
|
113
|
+
if canonical_tier == THIRD_PARTY_MODEL_TIER:
|
|
114
|
+
return False
|
|
115
|
+
if outcome_token == SPAWN_SUCCESS_TOKEN:
|
|
116
|
+
return True
|
|
117
|
+
if outcome_token == CLI_BIND_SUCCESS_TOKEN:
|
|
118
|
+
return True
|
|
119
|
+
return False
|
|
114
120
|
|
|
115
121
|
|
|
116
122
|
def validate_model_tier_run(run: ModelTierRun) -> None:
|
|
@@ -118,13 +124,16 @@ def validate_model_tier_run(run: ModelTierRun) -> None:
|
|
|
118
124
|
|
|
119
125
|
::
|
|
120
126
|
|
|
121
|
-
validate_model_tier_run(ladder_walk) # ok: multi-tier
|
|
122
|
-
validate_model_tier_run(
|
|
127
|
+
validate_model_tier_run(ladder_walk) # ok: multi-tier Agent walk
|
|
128
|
+
validate_model_tier_run(cli_bind) # ok: CLI Claude-chain bind
|
|
123
129
|
validate_model_tier_run(broken_log) # flag: ModelTierRunError
|
|
124
130
|
|
|
125
|
-
Candidate tiers must match the floor slice
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
Candidate tiers must match the floor slice. ``own_tier=ThirdParty`` maps to
|
|
132
|
+
the third-party-host CLI advisor floor (Fable → Opus). Tries walk that
|
|
133
|
+
slice in order;
|
|
134
|
+
early stop only after ``spawned`` or ``cli``. A null selected_tier requires
|
|
135
|
+
a full walk plus fallback_reason (fail-closed on a third-party host when
|
|
136
|
+
the chain cannot serve).
|
|
128
137
|
|
|
129
138
|
Args:
|
|
130
139
|
run: The structured spawn-walk log to check.
|
|
@@ -118,7 +118,13 @@ def test_selected_tier_not_first_spawned_attempt_raises() -> None:
|
|
|
118
118
|
],
|
|
119
119
|
selected_tier="Fable",
|
|
120
120
|
)
|
|
121
|
-
with pytest.raises(
|
|
121
|
+
with pytest.raises(
|
|
122
|
+
ModelTierRunError,
|
|
123
|
+
match=(
|
|
124
|
+
"selected_tier does not match the first successful bind "
|
|
125
|
+
r"\(spawned or cli\)"
|
|
126
|
+
),
|
|
127
|
+
):
|
|
122
128
|
validate_model_tier_run(run)
|
|
123
129
|
|
|
124
130
|
|
|
@@ -238,53 +244,117 @@ def test_cli_missing_path_returns_usage_exit_code() -> None:
|
|
|
238
244
|
assert main([]) == 2
|
|
239
245
|
|
|
240
246
|
|
|
241
|
-
def
|
|
247
|
+
def test_cli_bind_at_fable_passes() -> None:
|
|
242
248
|
run = ModelTierRun(
|
|
243
|
-
own_tier="
|
|
244
|
-
candidate_tiers=["
|
|
245
|
-
attempts=[{"tier": "
|
|
246
|
-
selected_tier="
|
|
249
|
+
own_tier="Opus",
|
|
250
|
+
candidate_tiers=["Fable", "Opus"],
|
|
251
|
+
attempts=[{"tier": "Fable", "result": "cli"}],
|
|
252
|
+
selected_tier="Fable",
|
|
247
253
|
)
|
|
248
254
|
assert validate_model_tier_run(run) is None
|
|
249
255
|
|
|
250
256
|
|
|
251
|
-
def
|
|
257
|
+
def test_cli_bind_fallthrough_to_opus_passes() -> None:
|
|
252
258
|
run = ModelTierRun(
|
|
253
|
-
own_tier="
|
|
254
|
-
candidate_tiers=["
|
|
255
|
-
attempts=[
|
|
256
|
-
|
|
259
|
+
own_tier="Opus",
|
|
260
|
+
candidate_tiers=["Fable", "Opus"],
|
|
261
|
+
attempts=[
|
|
262
|
+
{"tier": "Fable", "result": "unavailable"},
|
|
263
|
+
{"tier": "Opus", "result": "cli"},
|
|
264
|
+
],
|
|
265
|
+
selected_tier="Opus",
|
|
257
266
|
)
|
|
258
267
|
assert validate_model_tier_run(run) is None
|
|
259
268
|
|
|
260
269
|
|
|
261
|
-
def
|
|
270
|
+
def test_third_party_own_tier_maps_to_fable_opus_cli_bind_passes() -> None:
|
|
271
|
+
run = ModelTierRun(
|
|
272
|
+
own_tier="ThirdParty",
|
|
273
|
+
candidate_tiers=["Fable", "Opus"],
|
|
274
|
+
attempts=[{"tier": "Fable", "result": "cli"}],
|
|
275
|
+
selected_tier="Fable",
|
|
276
|
+
)
|
|
277
|
+
assert validate_model_tier_run(run) is None
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def test_third_party_own_tier_lowercase_cli_bind_passes() -> None:
|
|
281
|
+
run = ModelTierRun(
|
|
282
|
+
own_tier="thirdparty",
|
|
283
|
+
candidate_tiers=["fable", "opus"],
|
|
284
|
+
attempts=[{"tier": "fable", "result": "cli"}],
|
|
285
|
+
selected_tier="fable",
|
|
286
|
+
)
|
|
287
|
+
assert validate_model_tier_run(run) is None
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def test_self_token_is_not_bind_success_raises() -> None:
|
|
291
|
+
run = ModelTierRun(
|
|
292
|
+
own_tier="Opus",
|
|
293
|
+
candidate_tiers=["Fable", "Opus"],
|
|
294
|
+
attempts=[{"tier": "Fable", "result": "self"}],
|
|
295
|
+
selected_tier="Fable",
|
|
296
|
+
)
|
|
297
|
+
with pytest.raises(ModelTierRunError):
|
|
298
|
+
validate_model_tier_run(run)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def test_third_party_self_token_is_not_bind_success_raises() -> None:
|
|
262
302
|
run = ModelTierRun(
|
|
263
|
-
own_tier="
|
|
264
|
-
candidate_tiers=["Fable", "Opus"
|
|
265
|
-
attempts=[{"tier": "
|
|
266
|
-
selected_tier="
|
|
303
|
+
own_tier="ThirdParty",
|
|
304
|
+
candidate_tiers=["Fable", "Opus"],
|
|
305
|
+
attempts=[{"tier": "Fable", "result": "self"}],
|
|
306
|
+
selected_tier="Fable",
|
|
267
307
|
)
|
|
268
308
|
with pytest.raises(ModelTierRunError):
|
|
269
309
|
validate_model_tier_run(run)
|
|
270
310
|
|
|
271
311
|
|
|
272
|
-
def
|
|
312
|
+
def test_third_party_host_legacy_single_tier_self_bind_raises() -> None:
|
|
273
313
|
run = ModelTierRun(
|
|
274
|
-
own_tier="
|
|
275
|
-
candidate_tiers=["
|
|
276
|
-
attempts=[{"tier": "
|
|
277
|
-
selected_tier="
|
|
314
|
+
own_tier="ThirdParty",
|
|
315
|
+
candidate_tiers=["ThirdParty"],
|
|
316
|
+
attempts=[{"tier": "ThirdParty", "result": "self"}],
|
|
317
|
+
selected_tier="ThirdParty",
|
|
278
318
|
)
|
|
279
319
|
with pytest.raises(ModelTierRunError):
|
|
280
320
|
validate_model_tier_run(run)
|
|
281
321
|
|
|
282
322
|
|
|
283
|
-
def
|
|
323
|
+
def test_third_party_cli_exhausted_fail_closed_passes() -> None:
|
|
284
324
|
run = ModelTierRun(
|
|
285
|
-
own_tier="
|
|
286
|
-
candidate_tiers=["
|
|
287
|
-
attempts=[
|
|
325
|
+
own_tier="ThirdParty",
|
|
326
|
+
candidate_tiers=["Fable", "Opus"],
|
|
327
|
+
attempts=[
|
|
328
|
+
{"tier": "Fable", "result": "unavailable"},
|
|
329
|
+
{"tier": "Opus", "result": "unavailable"},
|
|
330
|
+
],
|
|
331
|
+
selected_tier=None,
|
|
332
|
+
fallback_reason=(
|
|
333
|
+
"third-party host CLI Claude-chain exhausted; fail closed"
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
assert validate_model_tier_run(run) is None
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def test_third_party_cli_exhausted_without_fallback_reason_raises() -> None:
|
|
340
|
+
run = ModelTierRun(
|
|
341
|
+
own_tier="ThirdParty",
|
|
342
|
+
candidate_tiers=["Fable", "Opus"],
|
|
343
|
+
attempts=[
|
|
344
|
+
{"tier": "Fable", "result": "unavailable"},
|
|
345
|
+
{"tier": "Opus", "result": "unavailable"},
|
|
346
|
+
],
|
|
347
|
+
selected_tier=None,
|
|
348
|
+
)
|
|
349
|
+
with pytest.raises(ModelTierRunError):
|
|
350
|
+
validate_model_tier_run(run)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def test_third_party_cli_selected_tier_mismatch_raises() -> None:
|
|
354
|
+
run = ModelTierRun(
|
|
355
|
+
own_tier="ThirdParty",
|
|
356
|
+
candidate_tiers=["Fable", "Opus"],
|
|
357
|
+
attempts=[{"tier": "Fable", "result": "cli"}],
|
|
288
358
|
selected_tier="Opus",
|
|
289
359
|
)
|
|
290
360
|
with pytest.raises(ModelTierRunError):
|
|
@@ -37,9 +37,9 @@ from advisor_scripts_constants.model_tier_run_validator_constants import ( # no
|
|
|
37
37
|
ALL_CLI_MODEL_ID_BY_TIER,
|
|
38
38
|
ALL_KNOWN_TIER_NAMES,
|
|
39
39
|
ALL_MODEL_TIERS,
|
|
40
|
-
GROK_MODEL_TIER,
|
|
41
40
|
HOST_PROFILE_CLAUDE,
|
|
42
|
-
|
|
41
|
+
HOST_PROFILE_THIRD_PARTY,
|
|
42
|
+
THIRD_PARTY_MODEL_TIER,
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
SCRIPTS_ROOT = Path(__file__).parent.parent
|
|
@@ -56,13 +56,13 @@ DOCUMENTED_RESOLVE_ONE_LINER = (
|
|
|
56
56
|
("Opus", "opus"),
|
|
57
57
|
("Sonnet", "sonnet"),
|
|
58
58
|
("Haiku", "haiku"),
|
|
59
|
-
("
|
|
59
|
+
("ThirdParty", "third-party"),
|
|
60
60
|
("fable", "fable"),
|
|
61
61
|
("OPUS", "opus"),
|
|
62
62
|
("sonnet", "sonnet"),
|
|
63
63
|
("hAiKu", "haiku"),
|
|
64
|
-
("
|
|
65
|
-
("
|
|
64
|
+
("thirdparty", "third-party"),
|
|
65
|
+
(" THIRDPARTY ", "third-party"),
|
|
66
66
|
(" Opus ", "opus"),
|
|
67
67
|
("\thaiku\n", "haiku"),
|
|
68
68
|
],
|
|
@@ -97,8 +97,8 @@ def test_sendmessage_reply_wait_is_positive_bound() -> None:
|
|
|
97
97
|
def test_cli_model_alias_map_keys_match_known_tiers() -> None:
|
|
98
98
|
assert set(ALL_CLI_MODEL_ID_BY_TIER) == set(ALL_KNOWN_TIER_NAMES)
|
|
99
99
|
assert set(ALL_MODEL_TIERS).issubset(set(ALL_KNOWN_TIER_NAMES))
|
|
100
|
-
assert
|
|
101
|
-
assert
|
|
100
|
+
assert THIRD_PARTY_MODEL_TIER in ALL_KNOWN_TIER_NAMES
|
|
101
|
+
assert THIRD_PARTY_MODEL_TIER not in ALL_MODEL_TIERS
|
|
102
102
|
assert all(
|
|
103
103
|
ALL_CLI_MODEL_ID_BY_TIER[each_tier] for each_tier in ALL_KNOWN_TIER_NAMES
|
|
104
104
|
)
|
|
@@ -106,7 +106,7 @@ def test_cli_model_alias_map_keys_match_known_tiers() -> None:
|
|
|
106
106
|
|
|
107
107
|
def test_canonical_tier_name_strips_and_normalizes() -> None:
|
|
108
108
|
assert canonical_tier_name(" opus ") == "Opus"
|
|
109
|
-
assert canonical_tier_name("
|
|
109
|
+
assert canonical_tier_name("thirdparty") == "ThirdParty"
|
|
110
110
|
assert canonical_tier_name("") is None
|
|
111
111
|
assert canonical_tier_name("Titan") is None
|
|
112
112
|
|
|
@@ -119,30 +119,30 @@ def test_detect_host_profile_defaults_to_claude() -> None:
|
|
|
119
119
|
"truthy_value",
|
|
120
120
|
["1", "true", "TRUE", "yes", "YES", "on", "On"],
|
|
121
121
|
)
|
|
122
|
-
def
|
|
122
|
+
def test_detect_host_profile_reads_third_party_truthy_values(
|
|
123
123
|
truthy_value: str,
|
|
124
124
|
) -> None:
|
|
125
125
|
assert (
|
|
126
|
-
detect_host_profile(setting_by_name={"
|
|
127
|
-
==
|
|
126
|
+
detect_host_profile(setting_by_name={"THIRD_PARTY": truthy_value})
|
|
127
|
+
== HOST_PROFILE_THIRD_PARTY
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
def
|
|
131
|
+
def test_detect_host_profile_reads_third_party_flag() -> None:
|
|
132
132
|
assert (
|
|
133
|
-
detect_host_profile(setting_by_name={"
|
|
133
|
+
detect_host_profile(setting_by_name={"THIRD_PARTY": "0"})
|
|
134
134
|
== HOST_PROFILE_CLAUDE
|
|
135
135
|
)
|
|
136
136
|
assert (
|
|
137
|
-
detect_host_profile(setting_by_name={"
|
|
137
|
+
detect_host_profile(setting_by_name={"THIRD_PARTY": "false"})
|
|
138
138
|
== HOST_PROFILE_CLAUDE
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
def test_detect_host_profile_reads_explicit_override() -> None:
|
|
143
143
|
assert (
|
|
144
|
-
detect_host_profile(setting_by_name={"ADVISOR_HOST_PROFILE": "
|
|
145
|
-
==
|
|
144
|
+
detect_host_profile(setting_by_name={"ADVISOR_HOST_PROFILE": "ThirdParty"})
|
|
145
|
+
== HOST_PROFILE_THIRD_PARTY
|
|
146
146
|
)
|
|
147
147
|
assert (
|
|
148
148
|
detect_host_profile(setting_by_name={"ADVISOR_HOST_PROFILE": "claude"})
|
|
@@ -150,7 +150,7 @@ def test_detect_host_profile_reads_explicit_override() -> None:
|
|
|
150
150
|
)
|
|
151
151
|
assert (
|
|
152
152
|
detect_host_profile(
|
|
153
|
-
setting_by_name={"ADVISOR_HOST_PROFILE": "Claude", "
|
|
153
|
+
setting_by_name={"ADVISOR_HOST_PROFILE": "Claude", "THIRD_PARTY": "1"}
|
|
154
154
|
)
|
|
155
155
|
== HOST_PROFILE_CLAUDE
|
|
156
156
|
)
|