ceo-orchestration 1.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/.claude/adr/ADR-001-runtime-state-directory.md +164 -0
- package/.claude/adr/ADR-002-hooks-package-layout.md +228 -0
- package/.claude/adr/ADR-003-branch-protection-replaces-skill-signing.md +266 -0
- package/.claude/adr/ADR-004-defer-bash-legacy-removal.md +171 -0
- package/.claude/adr/ADR-005-event-stream-v2.md +153 -0
- package/.claude/adr/ADR-006-registry-derived-manifests.md +145 -0
- package/.claude/adr/ADR-007-spec-v1-semver-rc-policy.md +159 -0
- package/.claude/adr/ADR-008-hook-adapter-layer.md +169 -0
- package/.claude/adr/ADR-009-squad-contract.md +167 -0
- package/.claude/adr/ADR-010-canonical-edit-sentinel.md +181 -0
- package/.claude/adr/ADR-011-event-stream-v2.1-injection-flag.md +150 -0
- package/.claude/adr/ADR-012-cross-adapter-golden-fixtures.md +182 -0
- package/.claude/adr/ADR-013-squad-trading-hft.md +135 -0
- package/.claude/adr/ADR-014-hook-migration-batch-policy.md +197 -0
- package/.claude/adr/ADR-015-reflexion-v2-outcome-loop.md +248 -0
- package/.claude/adr/ADR-016-spawn-token-tracking.md +179 -0
- package/.claude/adr/ADR-017-lesson-pruning-policy.md +193 -0
- package/.claude/adr/ADR-018-claim-grammar.md +302 -0
- package/.claude/adr/ADR-019-AMEND-1-confidence-gate-block-mode-lifecycle.md +128 -0
- package/.claude/adr/ADR-019-AMEND-2-CLASS-SHA_EXISTS-promote-to-high-confidence-block.md +67 -0
- package/.claude/adr/ADR-019-confidence-gate-enforcement-lifecycle.md +221 -0
- package/.claude/adr/ADR-020-lesson-pruning-policy-v2.md +171 -0
- package/.claude/adr/ADR-021-e2e-harness-contract.md +189 -0
- package/.claude/adr/ADR-022-reserved-slot.md +52 -0
- package/.claude/adr/ADR-023-docs-freshness-lifecycle.md +184 -0
- package/.claude/adr/ADR-024-perf-baseline-policy.md +222 -0
- package/.claude/adr/ADR-025-squad-edtech.md +236 -0
- package/.claude/adr/ADR-026-squad-government.md +263 -0
- package/.claude/adr/ADR-027-unified-agent-state-backend.md +266 -0
- package/.claude/adr/ADR-028-multi-llm-canonical-parity.md +244 -0
- package/.claude/adr/ADR-029-lexical-tfidf-retrieval.md +205 -0
- package/.claude/adr/ADR-030-llm-as-judge-methodology.md +336 -0
- package/.claude/adr/ADR-031-self-improving-skills.md +221 -0
- package/.claude/adr/ADR-032-interactive-debate-protocol.md +337 -0
- package/.claude/adr/ADR-033-cost-budget-enforcement.md +275 -0
- package/.claude/adr/ADR-034-shared-working-memory.md +233 -0
- package/.claude/adr/ADR-035-otel-export.md +242 -0
- package/.claude/adr/ADR-036-output-safety.md +263 -0
- package/.claude/adr/ADR-037-chaos-testing-methodology.md +289 -0
- package/.claude/adr/ADR-038-session-graph-continuity.md +243 -0
- package/.claude/adr/ADR-039-skill-marketplace-protocol.md +170 -0
- package/.claude/adr/ADR-040-AMEND-2-credential-blocking.md +390 -0
- package/.claude/adr/ADR-040-live-adapter-activation-contract.md +285 -0
- package/.claude/adr/ADR-041-transition-log-convention.md +272 -0
- package/.claude/adr/ADR-042-AMEND-1-read-only-mcp-tools-expansion.md +214 -0
- package/.claude/adr/ADR-042-mcp-server-contract.md +727 -0
- package/.claude/adr/ADR-043-soc2-audit-trail-mapping.md +503 -0
- package/.claude/adr/ADR-044-formal-verification-pilot.md +505 -0
- package/.claude/adr/ADR-045-policy-as-code-engine.md +705 -0
- package/.claude/adr/ADR-046-deterministic-replay.md +167 -0
- package/.claude/adr/ADR-047-predictive-budgeting.md +213 -0
- package/.claude/adr/ADR-048-cross-plan-memory.md +227 -0
- package/.claude/adr/ADR-049-policy-engine-dual-path-deprecation.md +96 -0
- package/.claude/adr/ADR-049a-worktree-orchestration-policy.md +414 -0
- package/.claude/adr/ADR-050-native-subagents-dual-rail.md +165 -0
- package/.claude/adr/ADR-051-skill-reference-expanded-trust-boundary.md +282 -0
- package/.claude/adr/ADR-052-multi-model-dispatch-by-role.md +444 -0
- package/.claude/adr/ADR-053-sentinel-hmac-deferred.md +227 -0
- package/.claude/adr/ADR-054-AMEND-1-anthropic-admin-key-tier.md +131 -0
- package/.claude/adr/ADR-054-github-token-rotation.md +111 -0
- package/.claude/adr/ADR-055-AMEND-1-spool-writer-async-drain.md +170 -0
- package/.claude/adr/ADR-055-AMEND-2-chain-reset-marker.md +126 -0
- package/.claude/adr/ADR-055-AMEND-3-opportunistic-drain-nonblocking.md +183 -0
- package/.claude/adr/ADR-055-audit-log-hmac-chain.md +264 -0
- package/.claude/adr/ADR-056-hook-lifecycle-expansion.md +261 -0
- package/.claude/adr/ADR-057-output-scan-redaction.md +268 -0
- package/.claude/adr/ADR-058-brainstorm-gate-and-two-pass-review.md +240 -0
- package/.claude/adr/ADR-059-skill-bootstrap-env-knob.md +204 -0
- package/.claude/adr/ADR-060-curated-skill-import-pipeline.md +464 -0
- package/.claude/adr/ADR-061-runtime-cost-streaming.md +171 -0
- package/.claude/adr/ADR-062-AMEND-1-rag-conditional-default-on-supersedes-opt-in.md +232 -0
- package/.claude/adr/ADR-062-rag-sidecar-mcp-opt-in.md +231 -0
- package/.claude/adr/ADR-063-agent-eval-empirical-dispatch-validation.md +609 -0
- package/.claude/adr/ADR-064-dynamic-tier-policy-learned-dispatch.md +288 -0
- package/.claude/adr/ADR-065-audit-event-naming-convention.md +185 -0
- package/.claude/adr/ADR-066-context-mode-orthogonal-to-manifest.md +92 -0
- package/.claude/adr/ADR-067-ceo-model-downshift-static-routing.md +219 -0
- package/.claude/adr/ADR-069-wondelai-skills-import-refused.md +183 -0
- package/.claude/adr/ADR-070-audit-emit-package-layout.md +228 -0
- package/.claude/adr/ADR-071-benchmark-comparison-methodology.md +209 -0
- package/.claude/adr/ADR-072-test-discovery-via-conftest.md +184 -0
- package/.claude/adr/ADR-073-semver-bump-criteria-sprint-32.md +209 -0
- package/.claude/adr/ADR-074-sprint-32-phase-3-b1-refused.md +320 -0
- package/.claude/adr/ADR-075-sprint-32-phase-5-b5-benchmark-refused.md +250 -0
- package/.claude/adr/ADR-076-sprint-32-final-closure.md +218 -0
- package/.claude/adr/ADR-077-2026-04-24-webfetch-injection-incident.md +203 -0
- package/.claude/adr/ADR-078-sentinel-cosign-clarification.md +295 -0
- package/.claude/adr/ADR-079-prompt-sha-salt-hmac-impact.md +221 -0
- package/.claude/adr/ADR-080-rail-anomaly-h4-defense-in-depth.md +1143 -0
- package/.claude/adr/ADR-081-token-as-time-unit.md +272 -0
- package/.claude/adr/ADR-082-l7c-mitigation-default-on.md +240 -0
- package/.claude/adr/ADR-083-mcp-injection-scanner.md +225 -0
- package/.claude/adr/ADR-084-multi-adapter-refused-claude-only.md +152 -0
- package/.claude/adr/ADR-085-framework-landscape-claude-only.md +183 -0
- package/.claude/adr/ADR-086-checkpointing-refused.md +124 -0
- package/.claude/adr/ADR-087-AMEND-1-otel-consume-native-opt-in.md +217 -0
- package/.claude/adr/ADR-087-otel-emit-refused.md +136 -0
- package/.claude/adr/ADR-088-guardrails-library-refused.md +128 -0
- package/.claude/adr/ADR-089-sec-cluster-disposition.md +182 -0
- package/.claude/adr/ADR-090-framework-activation-defaults.md +217 -0
- package/.claude/adr/ADR-091-dogfood-validation-deferred.md +128 -0
- package/.claude/adr/ADR-092-plan-closure-honest-deferral.md +165 -0
- package/.claude/adr/ADR-093-refused-adr-moratorium.md +181 -0
- package/.claude/adr/ADR-094-claude-sdk-compat-version-pinning.md +160 -0
- package/.claude/adr/ADR-095-calendar-gate-retraction.md +202 -0
- package/.claude/adr/ADR-096-vibecoder-only-by-design.md +215 -0
- package/.claude/adr/ADR-097-function-length-advisory-permanent.md +186 -0
- package/.claude/adr/ADR-098-ceo-boot-audit-emit-register.md +251 -0
- package/.claude/adr/ADR-099-changesets-adoption.md +245 -0
- package/.claude/adr/ADR-100-trusted-dependencies-re-affirm.md +208 -0
- package/.claude/adr/ADR-101-replay-redact-helper.md +106 -0
- package/.claude/adr/ADR-102-mcp-introspection-extends-042.md +165 -0
- package/.claude/adr/ADR-103-calendar-gate-final-purge.md +121 -0
- package/.claude/adr/ADR-104-AMEND-1-aek-dated-promotion-criteria.md +338 -0
- package/.claude/adr/ADR-104-adaptive-execution-kernel-advisory.md +210 -0
- package/.claude/adr/ADR-105-multi-llm-coordinated-supersede.md +126 -0
- package/.claude/adr/ADR-106-codex-mcp-adapter-contract.md +153 -0
- package/.claude/adr/ADR-107-pair-rail-mandatory-l2-plus.md +189 -0
- package/.claude/adr/ADR-108-cross-llm-veto-floor.md +129 -0
- package/.claude/adr/ADR-109-codex-skill-rehash-protocol.md +104 -0
- package/.claude/adr/ADR-110-codex-pretool-enforcement.md +94 -0
- package/.claude/adr/ADR-111-locked-corpus-governance.md +191 -0
- package/.claude/adr/ADR-112-grandfather-cap-scope-clarification.md +192 -0
- package/.claude/adr/ADR-113-plan-084-canonical-guard-extension.md +59 -0
- package/.claude/adr/ADR-114-codex-egress-redaction-symmetry.md +72 -0
- package/.claude/adr/ADR-115-post-sota-maintenance-mode.md +152 -0
- package/.claude/adr/ADR-116-AMEND-1-kernel-extension-v2.md +640 -0
- package/.claude/adr/ADR-116-kernel-hard-deny-tier-0-extension.md +465 -0
- package/.claude/adr/ADR-117-adr-id-collision-rename-policy.md +279 -0
- package/.claude/adr/ADR-118-AMEND-1-phase-c-enforcing-flip.md +191 -0
- package/.claude/adr/ADR-118-god-mode-auto-usable-state.md +338 -0
- package/.claude/adr/ADR-119-sentinel-unlock-contract.md +133 -0
- package/.claude/adr/ADR-120-pii-core-promotion.md +280 -0
- package/.claude/adr/ADR-121-sentinel-signers-rotation-policy.md +434 -0
- package/.claude/adr/ADR-122-dpop-mcp-bearer-replay-defense.md +232 -0
- package/.claude/adr/ADR-123-streaming-adapter-canonical-source.md +130 -0
- package/.claude/adr/ADR-124-post-audit-sota-execution-mode.md +362 -0
- package/.claude/adr/ADR-125-risk-tiered-defaulting-doctrine.md +355 -0
- package/.claude/adr/ADR-126-governed-sidecar-capability-model.md +509 -0
- package/.claude/adr/ADR-127-pair-rail-advisory-promotion.md +218 -0
- package/.claude/adr/ADR-128-c2-vector-memory-capability-class.md +380 -0
- package/.claude/adr/ADR-129-AMEND-1-key-floor-waiver-lift.md +249 -0
- package/.claude/adr/ADR-129-c1-crypto-capability-class.md +289 -0
- package/.claude/adr/ADR-131-c5-dev-tools-capability-class.md +215 -0
- package/.claude/adr/ADR-132-goap-advisory-planning-doctrine.md +333 -0
- package/.claude/adr/ADR-133-autonomous-loop-opt-in-capability-doctrine.md +440 -0
- package/.claude/adr/ADR-135-AMEND-1-write-mode-trust-boundary.md +457 -0
- package/.claude/adr/ADR-135-AMEND-2-write-mode-activation.md +175 -0
- package/.claude/adr/ADR-135-federation-contract-mvp.md +253 -0
- package/.claude/adr/ADR-136-AMEND-1-workflow-primitive-adoption.md +139 -0
- package/.claude/adr/ADR-136-workflow-engine-doctrine.md +155 -0
- package/.claude/adr/ADR-137-skill-priority-stack-decision.md +162 -0
- package/.claude/adr/ADR-138-ac-format-priority-and-story-anchor.md +149 -0
- package/.claude/adr/ADR-139-coverage-doctrine-tiered.md +133 -0
- package/.claude/adr/ADR-140-receiving-review-doctrine.md +136 -0
- package/.claude/adr/ADR-141-reduce-protocol.md +124 -0
- package/.claude/adr/ADR-142-opus-4-8-model-bump.md +116 -0
- package/.claude/adr/ADR-143-git-hook-bypass-guard.md +166 -0
- package/.claude/adr/ADR-144-subagent-model-tiering-frontmatter.md +111 -0
- package/.claude/adr/ADR-145-cross-model-review-persona-demand-modality.md +103 -0
- package/.claude/adr/ADR-146-adversary-review-hook.md +122 -0
- package/.claude/adr/ADR-147-eval-harness-doctrine.md +109 -0
- package/.claude/adr/ADR-148-canonical-pricing-source.md +123 -0
- package/.claude/adr/ADR-149-model-id-allowlist.md +196 -0
- package/.claude/adr/ADR-150-commit-signing-policy.md +12 -0
- package/.claude/adr/ADR-151-fan-plan-advisory-bridge.md +178 -0
- package/.claude/adr/ADR-152-claude-md-decomposition.md +262 -0
- package/.claude/adr/ADR-153-compaction-continuity.md +141 -0
- package/.claude/adr/ADR-154-updatedinput-single-rewriter.md +68 -0
- package/.claude/adr/ADR-155-install-baseline-manifest.md +66 -0
- package/.claude/adr/ADR-156-constitution-sync-cascade.md +122 -0
- package/.claude/adr/README.md +392 -0
- package/.claude/adversary.md +116 -0
- package/.claude/agent-metrics.md +101 -0
- package/.claude/agents/_dispatch.md +30 -0
- package/.claude/agents/_probe_architect.md +45 -0
- package/.claude/agents/_probe_canonical_edit.md +46 -0
- package/.claude/agents/_probe_missing_skill.md +42 -0
- package/.claude/agents/code-reviewer.md +166 -0
- package/.claude/agents/devops.md +114 -0
- package/.claude/agents/identity-trust-architect.md +234 -0
- package/.claude/agents/incident-commander.md +285 -0
- package/.claude/agents/llm-finops-architect.md +265 -0
- package/.claude/agents/performance-engineer.md +148 -0
- package/.claude/agents/qa-architect.md +167 -0
- package/.claude/agents/security-engineer.md +192 -0
- package/.claude/agents/threat-detection-engineer.md +238 -0
- package/.claude/benchmarks/_schemas/judge-prompt.md +26 -0
- package/.claude/benchmarks/_schemas/judge-rubric-example.json +11 -0
- package/.claude/benchmarks/_schemas/judge-rubric.yaml +39 -0
- package/.claude/benchmarks/calibration-grades.jsonl +6 -0
- package/.claude/benchmarks/human-sample-calibration.md +232 -0
- package/.claude/benchmarks/judge-rotation-schedule.md +61 -0
- package/.claude/benchmarks/retrieval-judgment-set.yaml +194 -0
- package/.claude/benchmarks/tests/test_retrieval_recall_gate.py +330 -0
- package/.claude/commands/agent-budget.md +105 -0
- package/.claude/commands/architect.md +130 -0
- package/.claude/commands/audit-page.md +149 -0
- package/.claude/commands/audit-tokens.md +89 -0
- package/.claude/commands/ceo-boot.md +118 -0
- package/.claude/commands/ceo-info.md +71 -0
- package/.claude/commands/debate.md +258 -0
- package/.claude/commands/effort.md +99 -0
- package/.claude/commands/fan-plan.md +129 -0
- package/.claude/commands/goap.md +163 -0
- package/.claude/commands/lesson-review.md +66 -0
- package/.claude/commands/memory-scratchpad.md +100 -0
- package/.claude/commands/onboard.md +204 -0
- package/.claude/commands/pitfall.md +54 -0
- package/.claude/commands/resume.md +90 -0
- package/.claude/commands/self-test.md +83 -0
- package/.claude/commands/skill-review.md +102 -0
- package/.claude/commands/spawn.md +212 -0
- package/.claude/commands/squad-install.md +94 -0
- package/.claude/commands/status.md +177 -0
- package/.claude/commands/terse.md +81 -0
- package/.claude/commands/veto-check.md +63 -0
- package/.claude/data/audit-registry.golden.txt +306 -0
- package/.claude/data/canonical_models.json +1030 -0
- package/.claude/data/confidence-gate-class-tiers.json +24 -0
- package/.claude/data/cookbook_patterns.json +139 -0
- package/.claude/data/federation/enabled.md +34 -0
- package/.claude/data/federation/lan-enabled.md +38 -0
- package/.claude/data/federation/peers.example.yaml +89 -0
- package/.claude/data/goap/action-cost-baseline.json +29 -0
- package/.claude/dispatcher/disable_predicate_eval.py +630 -0
- package/.claude/dispatcher/routing-matrix-loader.py +874 -0
- package/.claude/dispatcher/routing-matrix.yaml +343 -0
- package/.claude/dispatcher/tests/conftest.py +11 -0
- package/.claude/dispatcher/tests/test_disable_predicate_eval.py +424 -0
- package/.claude/dispatcher/tests/test_routing_matrix_loader.py +461 -0
- package/.claude/docs/dpop-scope.md +79 -0
- package/.claude/docs/sentinel-signers-rotation-DRAFT.md +117 -0
- package/.claude/eval/README.md +73 -0
- package/.claude/eval/reporter.py +109 -0
- package/.claude/eval/runner.py +532 -0
- package/.claude/eval/self_test.yaml +57 -0
- package/.claude/eval/tasks/__init__.py +185 -0
- package/.claude/eval/tasks/t01_fix_off_by_one.py +52 -0
- package/.claude/eval/tasks/t02_implement_fizzbuzz.py +65 -0
- package/.claude/eval/tasks/t03_json_config_parse.py +80 -0
- package/.claude/eval/tasks/t04_refactor_dedupe.py +71 -0
- package/.claude/eval/tasks/t05_add_unit_test.py +77 -0
- package/.claude/eval/tasks/t06_palindrome.py +58 -0
- package/.claude/eval/tasks/t07_sql_param_fix.py +69 -0
- package/.claude/eval/tasks/t08_word_count.py +53 -0
- package/.claude/eval/tasks/t09_readme_doc.py +64 -0
- package/.claude/eval/tasks/t10_binary_search.py +58 -0
- package/.claude/frontend-team.md +202 -0
- package/.claude/governance/README.md +37 -0
- package/.claude/governance/audit_tokens_allowlist.json +37 -0
- package/.claude/governance/codex-cli-binary-sha256.txt +32 -0
- package/.claude/governance/codex-cli-pin.txt +26 -0
- package/.claude/governance/function-length-grandfather.yaml +2095 -0
- package/.claude/governance/governance-waivers.yaml +28 -0
- package/.claude/governance/pair-rail-inputs-hash-manifest.txt +32 -0
- package/.claude/governance/pair-rail-verdict-template.md +58 -0
- package/.claude/governance/pair-rail-verdict-v1.16.0-rc.1.md +120 -0
- package/.claude/governance/pair-rail-verdict-v1.16.0.md +64 -0
- package/.claude/gpg-revocations.jsonl +1 -0
- package/.claude/hooks/SessionEnd.py +353 -0
- package/.claude/hooks/SessionStart.py +345 -0
- package/.claude/hooks/Stop.py +195 -0
- package/.claude/hooks/UserPromptSubmit.py +329 -0
- package/.claude/hooks/_lib/EXECUTION-CONTEXT-DEFERRED.md +82 -0
- package/.claude/hooks/_lib/__init__.py +26 -0
- package/.claude/hooks/_lib/action_required.py +592 -0
- package/.claude/hooks/_lib/adapters/__init__.py +87 -0
- package/.claude/hooks/_lib/adapters/_constants.py +127 -0
- package/.claude/hooks/_lib/adapters/claude.py +167 -0
- package/.claude/hooks/_lib/adapters/codex.py +754 -0
- package/.claude/hooks/_lib/adapters/live/__init__.py +378 -0
- package/.claude/hooks/_lib/adapters/live/_breaker.py +309 -0
- package/.claude/hooks/_lib/adapters/live/_cost.py +389 -0
- package/.claude/hooks/_lib/adapters/live/_policy.py +319 -0
- package/.claude/hooks/_lib/adapters/live/_result.py +206 -0
- package/.claude/hooks/_lib/adapters/live/_transport.py +681 -0
- package/.claude/hooks/_lib/adapters/live/claude.py +1027 -0
- package/.claude/hooks/_lib/adapters/live/claude_batch.py +652 -0
- package/.claude/hooks/_lib/adapters/live/gemini.py +270 -0
- package/.claude/hooks/_lib/adapters/live/local.py +195 -0
- package/.claude/hooks/_lib/adapters/live/openai.py +371 -0
- package/.claude/hooks/_lib/adversary_rules.py +196 -0
- package/.claude/hooks/_lib/agent_frontmatter.py +288 -0
- package/.claude/hooks/_lib/audit_emit.py +11746 -0
- package/.claude/hooks/_lib/audit_emit_dispatch.py +179 -0
- package/.claude/hooks/_lib/audit_hmac.py +1146 -0
- package/.claude/hooks/_lib/audit_rotation.py +101 -0
- package/.claude/hooks/_lib/canonical_json.py +145 -0
- package/.claude/hooks/_lib/codex_cli_shape.py +502 -0
- package/.claude/hooks/_lib/codex_egress_redact.py +185 -0
- package/.claude/hooks/_lib/confidence_labels.py +338 -0
- package/.claude/hooks/_lib/contract.py +254 -0
- package/.claude/hooks/_lib/cookbook_patterns.py +136 -0
- package/.claude/hooks/_lib/cost_envelope.py +719 -0
- package/.claude/hooks/_lib/credentials.py +188 -0
- package/.claude/hooks/_lib/effective_config.py +767 -0
- package/.claude/hooks/_lib/egress_taxonomy.py +448 -0
- package/.claude/hooks/_lib/embeddings.py +322 -0
- package/.claude/hooks/_lib/env_guard.py +353 -0
- package/.claude/hooks/_lib/env_persist_allowlist.py +147 -0
- package/.claude/hooks/_lib/escalation_signals.py +335 -0
- package/.claude/hooks/_lib/estimation/__init__.py +12 -0
- package/.claude/hooks/_lib/estimation/bayesian.py +147 -0
- package/.claude/hooks/_lib/estimation/pipeline.py +209 -0
- package/.claude/hooks/_lib/exceptions.py +101 -0
- package/.claude/hooks/_lib/execution_context.py +208 -0
- package/.claude/hooks/_lib/federation/__init__.py +104 -0
- package/.claude/hooks/_lib/federation/audit_chain.py +118 -0
- package/.claude/hooks/_lib/federation/audit_chain_ext.py +408 -0
- package/.claude/hooks/_lib/federation/cert_inspector.py +573 -0
- package/.claude/hooks/_lib/federation/client.py +327 -0
- package/.claude/hooks/_lib/federation/handlers/__init__.py +30 -0
- package/.claude/hooks/_lib/federation/handlers/audit_event_batch.py +346 -0
- package/.claude/hooks/_lib/federation/handlers/audit_event_push.py +395 -0
- package/.claude/hooks/_lib/federation/handlers/peer_register.py +484 -0
- package/.claude/hooks/_lib/federation/handlers/peer_revoke.py +356 -0
- package/.claude/hooks/_lib/federation/identity.py +1056 -0
- package/.claude/hooks/_lib/federation/rate_limit.py +476 -0
- package/.claude/hooks/_lib/federation/replay.py +284 -0
- package/.claude/hooks/_lib/federation/scopes.py +168 -0
- package/.claude/hooks/_lib/federation/server.py +2218 -0
- package/.claude/hooks/_lib/file_walker.py +145 -0
- package/.claude/hooks/_lib/filelock.py +191 -0
- package/.claude/hooks/_lib/frontmatter.py +124 -0
- package/.claude/hooks/_lib/git_bypass.py +971 -0
- package/.claude/hooks/_lib/gpg_verify.py +356 -0
- package/.claude/hooks/_lib/guardrail_validator.py +478 -0
- package/.claude/hooks/_lib/injection_patterns.py +252 -0
- package/.claude/hooks/_lib/injection_salt.py +160 -0
- package/.claude/hooks/_lib/mcp/__init__.py +5 -0
- package/.claude/hooks/_lib/mcp/bearer_replay.py +279 -0
- package/.claude/hooks/_lib/mcp/canonical_guard.py +1140 -0
- package/.claude/hooks/_lib/mcp_bearer_friction.py +475 -0
- package/.claude/hooks/_lib/mcp_injection_scan.py +250 -0
- package/.claude/hooks/_lib/mcp_routing.py +151 -0
- package/.claude/hooks/_lib/memory_shared.py +592 -0
- package/.claude/hooks/_lib/metrics.py +241 -0
- package/.claude/hooks/_lib/model_routing.py +227 -0
- package/.claude/hooks/_lib/otel/__init__.py +34 -0
- package/.claude/hooks/_lib/otel/bounded_exporter.py +373 -0
- package/.claude/hooks/_lib/otel/hook_bridge.py +53 -0
- package/.claude/hooks/_lib/otel/queue.py +229 -0
- package/.claude/hooks/_lib/otel_emit.py +604 -0
- package/.claude/hooks/_lib/output_scan.py +1062 -0
- package/.claude/hooks/_lib/output_scan_dedup.py +379 -0
- package/.claude/hooks/_lib/pair_rail_decide.py +244 -0
- package/.claude/hooks/_lib/payload.py +195 -0
- package/.claude/hooks/_lib/persona_routing.py +244 -0
- package/.claude/hooks/_lib/pii_patterns.py +851 -0
- package/.claude/hooks/_lib/plan_frontmatter.py +166 -0
- package/.claude/hooks/_lib/policy.py +1527 -0
- package/.claude/hooks/_lib/policy_preprocessors.py +462 -0
- package/.claude/hooks/_lib/rag_bridge.py +624 -0
- package/.claude/hooks/_lib/rag_events.py +171 -0
- package/.claude/hooks/_lib/rag_router.py +253 -0
- package/.claude/hooks/_lib/redact.py +228 -0
- package/.claude/hooks/_lib/replay_redact.py +511 -0
- package/.claude/hooks/_lib/scratchpad_lib.py +225 -0
- package/.claude/hooks/_lib/secret_patterns.py +905 -0
- package/.claude/hooks/_lib/sentinel_signers.py +740 -0
- package/.claude/hooks/_lib/spec_context_sanitizer.py +258 -0
- package/.claude/hooks/_lib/spool_writer.py +2613 -0
- package/.claude/hooks/_lib/state_store.py +476 -0
- package/.claude/hooks/_lib/subagent_dispatch.py +244 -0
- package/.claude/hooks/_lib/swarm_circuit_breaker.py +203 -0
- package/.claude/hooks/_lib/swarm_enable_gate.py +152 -0
- package/.claude/hooks/_lib/team.py +128 -0
- package/.claude/hooks/_lib/test_isolation.py +352 -0
- package/.claude/hooks/_lib/testing.py +351 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_attack_surface.py +251 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_audit_stitching.py +135 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_identity.py +234 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_replay.py +204 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_sentinel_stage2.py +214 -0
- package/.claude/hooks/_lib/tests/federation/test_federation_server.py +385 -0
- package/.claude/hooks/_lib/tests/test_confidence_gate_class_block.py +313 -0
- package/.claude/hooks/_lib/tests/test_cost_envelope.py +759 -0
- package/.claude/hooks/_lib/tests/test_execution_context.py +254 -0
- package/.claude/hooks/_lib/tests/test_goap_advisory_invariant.py +134 -0
- package/.claude/hooks/_lib/tests/test_goap_planner.py +368 -0
- package/.claude/hooks/_lib/tests/test_plan104_audit_emit.py +324 -0
- package/.claude/hooks/_lib/tests/test_plan104_demand_resolver.py +584 -0
- package/.claude/hooks/_lib/tests/test_plan104_demand_scan.py +164 -0
- package/.claude/hooks/_lib/tests/test_plan104_microbench.py +109 -0
- package/.claude/hooks/_lib/tests/test_plan104_waive_parser.py +113 -0
- package/.claude/hooks/_lib/tests/test_plan105_audit_emit.py +259 -0
- package/.claude/hooks/_lib/tests/test_plan105_check_roadmap_binding.py +68 -0
- package/.claude/hooks/_lib/tests/test_plan105_goap_planner.py +158 -0
- package/.claude/hooks/_lib/tests/test_plan105_spawn_outcome.py +234 -0
- package/.claude/hooks/_lib/tests/test_rag_dead_code_disposition.py +262 -0
- package/.claude/hooks/_lib/tests/test_rag_router.py +209 -0
- package/.claude/hooks/_lib/tests/test_swarm_circuit_breaker.py +278 -0
- package/.claude/hooks/_lib/tests/test_swarm_kill_switch_chain.py +360 -0
- package/.claude/hooks/_lib/tier_policy/__init__.py +123 -0
- package/.claude/hooks/_lib/tier_policy/_agent_frontmatter.py +509 -0
- package/.claude/hooks/_lib/tier_policy/_constants.py +376 -0
- package/.claude/hooks/_lib/tier_policy/_types.py +355 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/baseline.json +17 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/oversize_64kib.json +1 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/prototype_pollution_attack.yaml +14 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/schema_v1_sample.json +5 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/schema_v2_sample.json +17 -0
- package/.claude/hooks/_lib/tier_policy/fixtures/yaml_bomb_attack.yaml +20 -0
- package/.claude/hooks/_lib/tier_policy/loader.py +476 -0
- package/.claude/hooks/_lib/tokens.py +136 -0
- package/.claude/hooks/_lib/tool_lifecycle.py +488 -0
- package/.claude/hooks/_lib/trusted_env.py +77 -0
- package/.claude/hooks/_python-hook.sh +242 -0
- package/.claude/hooks/accel_dispatch.py +172 -0
- package/.claude/hooks/adequacy_gate.py +424 -0
- package/.claude/hooks/audit_log.py +1352 -0
- package/.claude/hooks/auto_boot.py +518 -0
- package/.claude/hooks/check_adversary.py +273 -0
- package/.claude/hooks/check_agent_spawn.py +2696 -0
- package/.claude/hooks/check_anti_ceo_overhead.py +786 -0
- package/.claude/hooks/check_arbitration_kernel.py +544 -0
- package/.claude/hooks/check_bash_canonical_forensic.py +180 -0
- package/.claude/hooks/check_bash_safety.py +1483 -0
- package/.claude/hooks/check_budget.py +916 -0
- package/.claude/hooks/check_canonical_edit.py +1197 -0
- package/.claude/hooks/check_closeout_guard.py +154 -0
- package/.claude/hooks/check_codex_filewrite.py +366 -0
- package/.claude/hooks/check_codex_response.py +403 -0
- package/.claude/hooks/check_confidence_gate.py +545 -0
- package/.claude/hooks/check_config_change.py +346 -0
- package/.claude/hooks/check_config_protection.py +381 -0
- package/.claude/hooks/check_cost_envelope.py +286 -0
- package/.claude/hooks/check_fluency_nudge.py +747 -0
- package/.claude/hooks/check_mcp_response.py +234 -0
- package/.claude/hooks/check_output_safety.py +237 -0
- package/.claude/hooks/check_output_secrets.py +518 -0
- package/.claude/hooks/check_pair_rail.py +1700 -0
- package/.claude/hooks/check_plan_edit.py +905 -0
- package/.claude/hooks/check_postcompact_reinject.py +265 -0
- package/.claude/hooks/check_precompact_continuity.py +379 -0
- package/.claude/hooks/check_protocol_semver_cascade.py +401 -0
- package/.claude/hooks/check_read_injection.py +366 -0
- package/.claude/hooks/check_scratchpad_access.py +228 -0
- package/.claude/hooks/check_setup_verification.py +297 -0
- package/.claude/hooks/check_skill_bootstrap_post.py +339 -0
- package/.claude/hooks/check_skill_patch_sentinel.py +413 -0
- package/.claude/hooks/check_skill_reference_read.py +518 -0
- package/.claude/hooks/check_subagent_fabrication.py +45 -0
- package/.claude/hooks/check_subagent_start.py +232 -0
- package/.claude/hooks/check_tier_policy.py +211 -0
- package/.claude/hooks/check_tier_policy_misrouting_24h.py +187 -0
- package/.claude/hooks/check_webfetch_injection.py +277 -0
- package/.claude/hooks/check_worktree_writer.py +773 -0
- package/.claude/hooks/codex_review_user_code.py +304 -0
- package/.claude/hooks/emit_architect_outcome.py +232 -0
- package/.claude/hooks/latency_report.py +343 -0
- package/.claude/hooks/policy_dispatch.py +168 -0
- package/.claude/hooks/review_loop.py +560 -0
- package/.claude/hooks/route.py +115 -0
- package/.claude/hooks/tests/_agent_fixture.py +153 -0
- package/.claude/hooks/tests/adapters/__init__.py +0 -0
- package/.claude/hooks/tests/adapters/live/__init__.py +0 -0
- package/.claude/hooks/tests/adapters/live/test_adapters.py +488 -0
- package/.claude/hooks/tests/adapters/live/test_audit_wiring.py +81 -0
- package/.claude/hooks/tests/adapters/live/test_breaker.py +272 -0
- package/.claude/hooks/tests/adapters/live/test_cost.py +191 -0
- package/.claude/hooks/tests/adapters/live/test_o7_modernization.py +670 -0
- package/.claude/hooks/tests/adapters/live/test_policy.py +168 -0
- package/.claude/hooks/tests/conftest.py +139 -0
- package/.claude/hooks/tests/fixtures/adapters/claude/in/agent_spawn_compliant.json +9 -0
- package/.claude/hooks/tests/fixtures/adapters/claude/in/bash_safe_command.json +8 -0
- package/.claude/hooks/tests/fixtures/adapters/claude/in/post_audit_event.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/claude/out/allow.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/claude/out/block_with_reason.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/codex/in/.gitkeep +1 -0
- package/.claude/hooks/tests/fixtures/adapters/codex/out/.gitkeep +1 -0
- package/.claude/hooks/tests/fixtures/adapters/gemini/GAPS.md +46 -0
- package/.claude/hooks/tests/fixtures/adapters/gemini/in/agent_spawn_minimal.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/gemini/in/bash_minimal.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/gemini/out/allow.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/local/in/agent_spawn_ollama.json +19 -0
- package/.claude/hooks/tests/fixtures/adapters/local/in/bash_minimal.json +8 -0
- package/.claude/hooks/tests/fixtures/adapters/local/out/allow.json +1 -0
- package/.claude/hooks/tests/fixtures/adapters/openai/in/agent_spawn_chat_completions.json +13 -0
- package/.claude/hooks/tests/fixtures/adapters/openai/in/bash_responses_api.json +9 -0
- package/.claude/hooks/tests/fixtures/adapters/openai/out/allow.json +1 -0
- package/.claude/hooks/tests/fixtures/anti_ceo_overhead/should-NOT-block-on-Y.ndjson +13 -0
- package/.claude/hooks/tests/fixtures/anti_ceo_overhead/should-block-on-X.ndjson +9 -0
- package/.claude/hooks/tests/fixtures/byte_identity/__init__.py +5 -0
- package/.claude/hooks/tests/fixtures/byte_identity/bash_safety_fuzzer.py +287 -0
- package/.claude/hooks/tests/fixtures/byte_identity/plan_edit_fuzzer.py +364 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/aws-iam-policy-arn-id-25.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/blog-paragraph-18.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/boilerplate-26.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/cdn-cache-key-12.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/certificate-fingerprint-10.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/changelog-19.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/commit-sha-01.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/django-csrf-token-24.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/docker-image-04.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/docs-example-22.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/haiku-20.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/hex-placeholder-15.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/hex-short-23.txt +5 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/image-thumbnail-09.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/jwt-payload-decoded-08.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/kubernetes-uid-06.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/md5-hash-02.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/phone-number-16.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/postgres-uuid-05.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/redis-cluster-node-13.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/session-token-11.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/sha256-checksum-03.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/short-token-21.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/software-license-14.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/telemetry-trace-07.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/negative/zip-postal-17.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/binance-api-key-alnum-03.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/binance-api-key-hex-01.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/binance-api-key-hex-02.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bip39-mnemonic-12-31.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bip39-mnemonic-12-33.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bip39-mnemonic-24-32.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bitfinex-api-key-11.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bitfinex-api-key-12.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bitfinex-api-key-13.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bitstamp-api-key-30.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bitstamp-customer-id-29.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bybit-api-key-18.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bybit-api-key-19.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bybit-api-secret-20.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/bybit-combined-21.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/coinbase-api-key-uuid-04.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/coinbase-api-secret-b64-05.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/coinbase-combined-07.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/coinbase-passphrase-06.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/evm-private-key-34.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/evm-private-key-35.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/evm-private-key-36.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/generic-api-key-37.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/generic-api-key-38.txt +3 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/generic-api-key-39.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kraken-api-key-08.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kraken-api-secret-09.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kraken-combined-10.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kucoin-api-key-uuid-26.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kucoin-api-secret-uuid-27.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/kucoin-passphrase-28.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/okx-api-key-uuid-22.txt +1 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/okx-api-secret-23.txt +2 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/okx-combined-25.txt +4 -0
- package/.claude/hooks/tests/fixtures/exchange_keys/positive/okx-passphrase-24.txt +1 -0
- package/.claude/hooks/tests/fixtures/hooks/audit_log/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/audit_log/out.json +0 -0
- package/.claude/hooks/tests/fixtures/hooks/check_agent_spawn/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_agent_spawn/out.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_bash_safety/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_bash_safety/out.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_canonical_edit/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_canonical_edit/out.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_confidence_gate/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_confidence_gate/out.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_plan_edit/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_plan_edit/out.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_read_injection/in.json +1 -0
- package/.claude/hooks/tests/fixtures/hooks/check_read_injection/out.json +1 -0
- package/.claude/hooks/tests/fixtures/lifecycle/concurrent_interleaved.json +36 -0
- package/.claude/hooks/tests/fixtures/lifecycle/orphaned_pre.json +8 -0
- package/.claude/hooks/tests/fixtures/lifecycle/paired_bash_post.json +8 -0
- package/.claude/hooks/tests/fixtures/lifecycle/paired_bash_pre.json +9 -0
- package/.claude/hooks/tests/fixtures/normalized/agent_spawn_chat_completions.json +36 -0
- package/.claude/hooks/tests/fixtures/normalized/agent_spawn_compliant.json +24 -0
- package/.claude/hooks/tests/fixtures/normalized/agent_spawn_minimal.json +24 -0
- package/.claude/hooks/tests/fixtures/normalized/agent_spawn_ollama.json +42 -0
- package/.claude/hooks/tests/fixtures/normalized/bash_minimal.json +23 -0
- package/.claude/hooks/tests/fixtures/normalized/bash_responses_api.json +32 -0
- package/.claude/hooks/tests/fixtures/normalized/bash_safe_command.json +23 -0
- package/.claude/hooks/tests/fixtures/normalized/post_audit_event.json +31 -0
- package/.claude/hooks/tests/fixtures/output_safety/control/01_random_hash_log.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/control/02_docs_mention_email_no_address.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/control/03_partial_jwt_two_segments.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/control/04_random_11_digits_no_cpf_context.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/control/05_credit_card_shape_invalid_luhn.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/01_api_key_anthropic.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/02_api_key_github_pat_classic.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/03_api_key_github_fine_grained.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/04_api_key_aws_access_key.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/05_api_key_aws_secret_assignment.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/06_jwt.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/07_bearer.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/08_cpf_with_context.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/09_cnpj_with_context.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/10_credit_card_luhn_valid.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/11_email_in_login_context.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/12_nfkc_full_width.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/13_zero_width_evasion.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/14_bidi_evasion.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_safety/positive/15_base64_encoded_secret.txt +1 -0
- package/.claude/hooks/tests/fixtures/output_scan/scenarios.jsonl +45 -0
- package/.claude/hooks/tests/fixtures/sample_payload_clean.json +13 -0
- package/.claude/hooks/tests/fixtures/sample_payload_with_secrets.json +12 -0
- package/.claude/hooks/tests/mutations/README.md +86 -0
- package/.claude/hooks/tests/mutations/__init__.py +14 -0
- package/.claude/hooks/tests/mutations/engine_mutations/__init__.py +15 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_01_parser_accepts_anchor.py +51 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_02_parser_skip_depth_limit.py +38 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_03_parser_accept_multi_doc.py +47 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_04_parser_accepts_bom.py +41 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_05_parser_scalar_len_off_by_one.py +61 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_06_parser_accepts_python_tag.py +50 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_07_parser_accepts_tab_indent.py +56 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_08_compiler_skip_regex_compile.py +45 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_09_compiler_regex_pattern_cap_off.py +31 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_10_compiler_accept_unknown_form.py +42 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_11_compiler_missing_predicate_tolerated.py +79 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_12_compiler_duplicate_rule_id_tolerated.py +66 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_13_compiler_missing_top_level_key_tolerated.py +46 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_14_compiler_schema_version_passthrough.py +43 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_15_evaluator_any_empty_returns_true.py +41 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_16_evaluator_all_empty_returns_true.py +37 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_17_evaluator_not_passthrough.py +37 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_18_evaluator_eq_true_on_type_mismatch.py +51 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_19_evaluator_regex_match_only.py +43 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_20_evaluator_path_under_no_realpath.py +48 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_21_evaluator_in_accepts_any.py +37 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_22_evaluator_length_off_by_one.py +45 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_23_evaluator_first_match_becomes_last.py +66 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_24_error_model_wrong_kind_on_parse.py +39 -0
- package/.claude/hooks/tests/mutations/engine_mutations/mutation_25_error_model_fail_open_on_load.py +42 -0
- package/.claude/hooks/tests/mutations/policy_mutations/__init__.py +16 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_01_remove_credential_leak.py +49 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_02_remove_rm_rf.py +44 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_03_remove_git_reset_hard.py +44 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_04_remove_git_push_force.py +44 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_05_reorder_rules.py +59 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_06_change_reason_enum.py +54 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_07_default_flipped_to_block.py +56 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_bash_08_flip_rm_rf_to_allow.py +49 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_01_remove_illegal_transition.py +79 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_02_remove_illegal_status.py +80 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_03_remove_missing_reviewed_at.py +80 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_04_remove_missing_completed_at.py +80 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_05_remove_missing_related_commits.py +79 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_06_remove_missing_abandonment_reason.py +80 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_07_scope_guard_inverted.py +93 -0
- package/.claude/hooks/tests/mutations/policy_mutations/mutation_plan_08_default_block.py +90 -0
- package/.claude/hooks/tests/probes/test_architect_probe.py +286 -0
- package/.claude/hooks/tests/probes/test_canonical_edit_probe.py +190 -0
- package/.claude/hooks/tests/probes/test_skill_content_probe.py +219 -0
- package/.claude/hooks/tests/test_SessionEnd.py +59 -0
- package/.claude/hooks/tests/test_SessionStart.py +42 -0
- package/.claude/hooks/tests/test_UserPromptSubmit.py +47 -0
- package/.claude/hooks/tests/test_accel_dispatch.py +96 -0
- package/.claude/hooks/tests/test_action_required_invariants.py +274 -0
- package/.claude/hooks/tests/test_adapter_drift_detector.py +254 -0
- package/.claude/hooks/tests/test_adapter_golden.py +198 -0
- package/.claude/hooks/tests/test_adequacy_gate.py +86 -0
- package/.claude/hooks/tests/test_adr_052_role_to_model_coverage.py +112 -0
- package/.claude/hooks/tests/test_adr_058_brainstorm_structure.py +280 -0
- package/.claude/hooks/tests/test_adversary_rules_live.py +400 -0
- package/.claude/hooks/tests/test_agent_frontmatter.py +377 -0
- package/.claude/hooks/tests/test_anti_ceo_overhead.py +591 -0
- package/.claude/hooks/tests/test_audit_emit.py +1707 -0
- package/.claude/hooks/tests/test_audit_emit_api_contract.py +693 -0
- package/.claude/hooks/tests/test_audit_emit_async_flush.py +563 -0
- package/.claude/hooks/tests/test_audit_emit_backpressure.py +138 -0
- package/.claude/hooks/tests/test_audit_emit_callsite_coverage_matrix.py +101 -0
- package/.claude/hooks/tests/test_audit_emit_chain_length.py +357 -0
- package/.claude/hooks/tests/test_audit_emit_coverage.py +2679 -0
- package/.claude/hooks/tests/test_audit_emit_ghost_action_guard.py +447 -0
- package/.claude/hooks/tests/test_audit_emit_plan088_canonical13.py +323 -0
- package/.claude/hooks/tests/test_audit_emit_rotation.py +218 -0
- package/.claude/hooks/tests/test_audit_emit_veto_v214.py +202 -0
- package/.claude/hooks/tests/test_audit_emit_wire_audit.py +699 -0
- package/.claude/hooks/tests/test_audit_hmac.py +334 -0
- package/.claude/hooks/tests/test_audit_hmac_branch_coverage.py +212 -0
- package/.claude/hooks/tests/test_audit_hmac_chain_monotonicity_property.py +136 -0
- package/.claude/hooks/tests/test_audit_hmac_coverage_v214.py +358 -0
- package/.claude/hooks/tests/test_audit_hmac_hardening.py +302 -0
- package/.claude/hooks/tests/test_audit_hmac_rotation_scenarios.py +231 -0
- package/.claude/hooks/tests/test_audit_hmac_verify_chain.py +443 -0
- package/.claude/hooks/tests/test_audit_log.py +280 -0
- package/.claude/hooks/tests/test_audit_log_coverage.py +173 -0
- package/.claude/hooks/tests/test_audit_log_path_d.py +516 -0
- package/.claude/hooks/tests/test_audit_log_phase1.py +358 -0
- package/.claude/hooks/tests/test_audit_log_schema_consistency.py +97 -0
- package/.claude/hooks/tests/test_audit_log_security.py +289 -0
- package/.claude/hooks/tests/test_audit_log_tokens.py +92 -0
- package/.claude/hooks/tests/test_audit_log_v2_7.py +378 -0
- package/.claude/hooks/tests/test_audit_log_v2_8_model.py +201 -0
- package/.claude/hooks/tests/test_audit_rotation.py +158 -0
- package/.claude/hooks/tests/test_audit_stream_verbose_protection.py +86 -0
- package/.claude/hooks/tests/test_audit_tokens_content_ban.py +512 -0
- package/.claude/hooks/tests/test_auto_boot.py +28 -0
- package/.claude/hooks/tests/test_available_models_mirror.py +226 -0
- package/.claude/hooks/tests/test_bash_canonical_forensic.py +74 -0
- package/.claude/hooks/tests/test_bash_canonical_interceptor.py +79 -0
- package/.claude/hooks/tests/test_brotli_passthrough.py +145 -0
- package/.claude/hooks/tests/test_byte_identity_fuzzer.py +185 -0
- package/.claude/hooks/tests/test_byte_identity_harness.py +953 -0
- package/.claude/hooks/tests/test_canonical_guard_typed_exceptions.py +117 -0
- package/.claude/hooks/tests/test_canonical_json.py +153 -0
- package/.claude/hooks/tests/test_chain_invariants_property.py +132 -0
- package/.claude/hooks/tests/test_check_adversary_live.py +149 -0
- package/.claude/hooks/tests/test_check_agent_spawn.py +1084 -0
- package/.claude/hooks/tests/test_check_agent_spawn_coverage.py +277 -0
- package/.claude/hooks/tests/test_check_agent_spawn_effort_token.py +74 -0
- package/.claude/hooks/tests/test_check_agent_spawn_import_isolation.py +82 -0
- package/.claude/hooks/tests/test_check_agent_spawn_model_routing_mode.py +245 -0
- package/.claude/hooks/tests/test_check_agent_spawn_reference_bypass.py +385 -0
- package/.claude/hooks/tests/test_check_agent_spawn_routing_promotion.py +302 -0
- package/.claude/hooks/tests/test_check_agent_spawn_skill_reference.py +336 -0
- package/.claude/hooks/tests/test_check_arbitration_kernel.py +472 -0
- package/.claude/hooks/tests/test_check_arbitration_kernel_v214.py +157 -0
- package/.claude/hooks/tests/test_check_bash_safety.py +546 -0
- package/.claude/hooks/tests/test_check_bash_safety_canonical_matrix.py +336 -0
- package/.claude/hooks/tests/test_check_bash_safety_cp_chaining.py +120 -0
- package/.claude/hooks/tests/test_check_bash_safety_h5_rewrite.py +462 -0
- package/.claude/hooks/tests/test_check_budget.py +580 -0
- package/.claude/hooks/tests/test_check_budget_max_tokens.py +397 -0
- package/.claude/hooks/tests/test_check_budget_quota_hint.py +115 -0
- package/.claude/hooks/tests/test_check_canonical_edit.py +302 -0
- package/.claude/hooks/tests/test_check_canonical_edit_coverage.py +370 -0
- package/.claude/hooks/tests/test_check_canonical_edit_kernel_v2.py +401 -0
- package/.claude/hooks/tests/test_check_canonical_edit_markers.py +473 -0
- package/.claude/hooks/tests/test_check_canonical_edit_mcp.py +401 -0
- package/.claude/hooks/tests/test_check_canonical_edit_session67_format.py +245 -0
- package/.claude/hooks/tests/test_check_codex_filewrite.py +964 -0
- package/.claude/hooks/tests/test_check_codex_response.py +419 -0
- package/.claude/hooks/tests/test_check_compaction_continuity.py +450 -0
- package/.claude/hooks/tests/test_check_confidence_gate.py +326 -0
- package/.claude/hooks/tests/test_check_config_change.py +369 -0
- package/.claude/hooks/tests/test_check_config_protection.py +364 -0
- package/.claude/hooks/tests/test_check_fluency_nudge.py +321 -0
- package/.claude/hooks/tests/test_check_mcp_response.py +261 -0
- package/.claude/hooks/tests/test_check_output_safety.py +314 -0
- package/.claude/hooks/tests/test_check_output_secrets.py +488 -0
- package/.claude/hooks/tests/test_check_output_secrets_coverage.py +321 -0
- package/.claude/hooks/tests/test_check_pair_rail.py +897 -0
- package/.claude/hooks/tests/test_check_pair_rail_decide_canonical.py +297 -0
- package/.claude/hooks/tests/test_check_pair_rail_golden.py +362 -0
- package/.claude/hooks/tests/test_check_pair_rail_hook_integration.py +120 -0
- package/.claude/hooks/tests/test_check_pair_rail_matrix.py +1077 -0
- package/.claude/hooks/tests/test_check_plan_edit.py +679 -0
- package/.claude/hooks/tests/test_check_plan_edit_stranded.py +310 -0
- package/.claude/hooks/tests/test_check_protocol_semver_cascade.py +141 -0
- package/.claude/hooks/tests/test_check_protocol_semver_cascade_settings_wired.py +297 -0
- package/.claude/hooks/tests/test_check_protocol_semver_cascade_synccascade.py +365 -0
- package/.claude/hooks/tests/test_check_read_injection.py +143 -0
- package/.claude/hooks/tests/test_check_read_injection_coverage.py +237 -0
- package/.claude/hooks/tests/test_check_read_injection_pathbound.py +153 -0
- package/.claude/hooks/tests/test_check_scratchpad_access.py +244 -0
- package/.claude/hooks/tests/test_check_skill_bootstrap_post.py +256 -0
- package/.claude/hooks/tests/test_check_skill_patch_sentinel.py +439 -0
- package/.claude/hooks/tests/test_check_skill_reference_read.py +170 -0
- package/.claude/hooks/tests/test_check_skill_reference_read_v2.py +388 -0
- package/.claude/hooks/tests/test_check_subagent_fabrication.py +54 -0
- package/.claude/hooks/tests/test_check_subagent_start.py +505 -0
- package/.claude/hooks/tests/test_check_tier_policy.py +48 -0
- package/.claude/hooks/tests/test_check_tier_policy_misrouting_24h.py +294 -0
- package/.claude/hooks/tests/test_check_webfetch_injection.py +49 -0
- package/.claude/hooks/tests/test_claim_producer_pair_end_to_end_loop_perf.py +227 -0
- package/.claude/hooks/tests/test_claude_adapter_thinking.py +731 -0
- package/.claude/hooks/tests/test_claude_batch_adapter.py +672 -0
- package/.claude/hooks/tests/test_closeout_guard.py +184 -0
- package/.claude/hooks/tests/test_codex_adapter.py +777 -0
- package/.claude/hooks/tests/test_codex_cli_shape.py +217 -0
- package/.claude/hooks/tests/test_codex_egress_proof_telemetry.py +214 -0
- package/.claude/hooks/tests/test_codex_egress_redact.py +342 -0
- package/.claude/hooks/tests/test_codex_egress_redact_outgoing.py +236 -0
- package/.claude/hooks/tests/test_codex_reply_multi_turn.py +72 -0
- package/.claude/hooks/tests/test_codex_review_user_code.py +44 -0
- package/.claude/hooks/tests/test_codex_strict_json.py +123 -0
- package/.claude/hooks/tests/test_confidence_gate_producer_pair.py +522 -0
- package/.claude/hooks/tests/test_confidence_labels.py +362 -0
- package/.claude/hooks/tests/test_contract.py +237 -0
- package/.claude/hooks/tests/test_cookbook_advisor_hook.py +208 -0
- package/.claude/hooks/tests/test_credentials.py +195 -0
- package/.claude/hooks/tests/test_detect_repo_profile_branches.py +116 -0
- package/.claude/hooks/tests/test_e2e_hook_chain.py +184 -0
- package/.claude/hooks/tests/test_effective_config.py +648 -0
- package/.claude/hooks/tests/test_emit_architect_outcome.py +175 -0
- package/.claude/hooks/tests/test_env_persist_allowlist.py +365 -0
- package/.claude/hooks/tests/test_escalation_signals.py +357 -0
- package/.claude/hooks/tests/test_estimation_bayesian_pipeline.py +140 -0
- package/.claude/hooks/tests/test_execution_context_deferral.py +222 -0
- package/.claude/hooks/tests/test_fail_open_contract.py +118 -0
- package/.claude/hooks/tests/test_file_walker.py +332 -0
- package/.claude/hooks/tests/test_filelock.py +131 -0
- package/.claude/hooks/tests/test_filelock_contract.py +172 -0
- package/.claude/hooks/tests/test_find_sentinels_pattern_matrix.py +114 -0
- package/.claude/hooks/tests/test_flip_closures.py +219 -0
- package/.claude/hooks/tests/test_frontmatter.py +139 -0
- package/.claude/hooks/tests/test_git_bypass_guard.py +1095 -0
- package/.claude/hooks/tests/test_gpg_verify.py +578 -0
- package/.claude/hooks/tests/test_hook_byte_fidelity.py +113 -0
- package/.claude/hooks/tests/test_hook_latency.py +245 -0
- package/.claude/hooks/tests/test_hook_latency_import.py +178 -0
- package/.claude/hooks/tests/test_injection_patterns.py +276 -0
- package/.claude/hooks/tests/test_injection_patterns_bypass.py +276 -0
- package/.claude/hooks/tests/test_injection_salt.py +191 -0
- package/.claude/hooks/tests/test_kernel_subsumes_security_critical_lib.py +88 -0
- package/.claude/hooks/tests/test_kill_switch_godmode_enforcing.py +101 -0
- package/.claude/hooks/tests/test_latency_report.py +28 -0
- package/.claude/hooks/tests/test_lib_canonical_import.py +355 -0
- package/.claude/hooks/tests/test_lifecycle_edge_cases.py +565 -0
- package/.claude/hooks/tests/test_live_adapters.py +463 -0
- package/.claude/hooks/tests/test_live_audit_isolation.py +357 -0
- package/.claude/hooks/tests/test_mcp_bearer_friction_buffer.py +276 -0
- package/.claude/hooks/tests/test_mcp_bearer_friction_emit.py +117 -0
- package/.claude/hooks/tests/test_mcp_canonical_guard.py +1989 -0
- package/.claude/hooks/tests/test_mcp_injection_repro_harness.py +437 -0
- package/.claude/hooks/tests/test_mcp_injection_scan.py +228 -0
- package/.claude/hooks/tests/test_mcp_routing_resolve.py +246 -0
- package/.claude/hooks/tests/test_memory_shared.py +412 -0
- package/.claude/hooks/tests/test_metrics.py +115 -0
- package/.claude/hooks/tests/test_migrated_hooks_fixtures.py +121 -0
- package/.claude/hooks/tests/test_model_routing.py +175 -0
- package/.claude/hooks/tests/test_model_routing_resolve.py +97 -0
- package/.claude/hooks/tests/test_model_routing_resolve_full.py +318 -0
- package/.claude/hooks/tests/test_otel_bounded_exporter.py +521 -0
- package/.claude/hooks/tests/test_otel_emit.py +243 -0
- package/.claude/hooks/tests/test_otel_queue.py +334 -0
- package/.claude/hooks/tests/test_otel_wire_defaultoff.py +392 -0
- package/.claude/hooks/tests/test_output_scan.py +1119 -0
- package/.claude/hooks/tests/test_output_scan_dedup.py +329 -0
- package/.claude/hooks/tests/test_output_scan_fixtures.py +136 -0
- package/.claude/hooks/tests/test_pair_rail_decide.py +141 -0
- package/.claude/hooks/tests/test_payload.py +89 -0
- package/.claude/hooks/tests/test_persona_coverage_wire.py +376 -0
- package/.claude/hooks/tests/test_persona_routing_enforcing.py +119 -0
- package/.claude/hooks/tests/test_phase_c_advisory_audit.py +75 -0
- package/.claude/hooks/tests/test_pii_patterns.py +558 -0
- package/.claude/hooks/tests/test_plan114_wires.py +468 -0
- package/.claude/hooks/tests/test_plan128_emit_wiring.py +74 -0
- package/.claude/hooks/tests/test_plan132_codex_review_observe.py +99 -0
- package/.claude/hooks/tests/test_plan133_a1_env_guard.py +221 -0
- package/.claude/hooks/tests/test_plan133_a2_canonical_skill_unicode.py +359 -0
- package/.claude/hooks/tests/test_plan133_a2_invisible_unicode.py +239 -0
- package/.claude/hooks/tests/test_plan133_a3_egress_taxonomy.py +221 -0
- package/.claude/hooks/tests/test_plan133_e1_adversary.py +360 -0
- package/.claude/hooks/tests/test_plan_085_wave_c_callsites_preserved.py +147 -0
- package/.claude/hooks/tests/test_plan_091_expected_callsites.py +206 -0
- package/.claude/hooks/tests/test_plan_frontmatter.py +217 -0
- package/.claude/hooks/tests/test_policy_coverage_residual_session73.py +597 -0
- package/.claude/hooks/tests/test_policy_coverage_v214.py +1099 -0
- package/.claude/hooks/tests/test_policy_dispatch.py +454 -0
- package/.claude/hooks/tests/test_policy_engine.py +791 -0
- package/.claude/hooks/tests/test_policy_fuzz_bomb.py +356 -0
- package/.claude/hooks/tests/test_policy_golden_error_kinds.py +287 -0
- package/.claude/hooks/tests/test_policy_mutations.py +359 -0
- package/.claude/hooks/tests/test_policy_preprocessors.py +514 -0
- package/.claude/hooks/tests/test_policy_redos_guards.py +393 -0
- package/.claude/hooks/tests/test_rag_bridge.py +675 -0
- package/.claude/hooks/tests/test_rag_events.py +202 -0
- package/.claude/hooks/tests/test_red_team_fixtures.py +427 -0
- package/.claude/hooks/tests/test_redact.py +506 -0
- package/.claude/hooks/tests/test_redact_redos.py +254 -0
- package/.claude/hooks/tests/test_redact_secrets_parity.py +334 -0
- package/.claude/hooks/tests/test_replay_determinism.py +263 -0
- package/.claude/hooks/tests/test_review_loop.py +28 -0
- package/.claude/hooks/tests/test_review_loop_wiring.py +206 -0
- package/.claude/hooks/tests/test_route.py +36 -0
- package/.claude/hooks/tests/test_rubric_catalogue.py +359 -0
- package/.claude/hooks/tests/test_scratchpad_lib.py +259 -0
- package/.claude/hooks/tests/test_secret_patterns.py +680 -0
- package/.claude/hooks/tests/test_secret_patterns_provenance.py +82 -0
- package/.claude/hooks/tests/test_sentinel_session_cache.py +324 -0
- package/.claude/hooks/tests/test_sentinel_session_cache_tier1.py +205 -0
- package/.claude/hooks/tests/test_sentinel_signers.py +641 -0
- package/.claude/hooks/tests/test_session_75_kernel_findings.py +180 -0
- package/.claude/hooks/tests/test_session_76_audit_v3_findings.py +493 -0
- package/.claude/hooks/tests/test_session_77_audit_v3_backlog_findings.py +644 -0
- package/.claude/hooks/tests/test_session_77_round_2_findings.py +135 -0
- package/.claude/hooks/tests/test_session_77_round_3_findings.py +159 -0
- package/.claude/hooks/tests/test_session_77_round_4_findings.py +120 -0
- package/.claude/hooks/tests/test_session_end.py +113 -0
- package/.claude/hooks/tests/test_session_start.py +293 -0
- package/.claude/hooks/tests/test_skill_unknown_ratio_path_d.py +249 -0
- package/.claude/hooks/tests/test_smart_loading_resolver_caching.py +140 -0
- package/.claude/hooks/tests/test_spec_context_sanitizer.py +179 -0
- package/.claude/hooks/tests/test_spool_drain_contended_skip.py +249 -0
- package/.claude/hooks/tests/test_spool_drain_rotation_property_b.py +227 -0
- package/.claude/hooks/tests/test_spool_drain_rotation_race.py +395 -0
- package/.claude/hooks/tests/test_spool_writer_cache.py +463 -0
- package/.claude/hooks/tests/test_state_store.py +302 -0
- package/.claude/hooks/tests/test_stop.py +133 -0
- package/.claude/hooks/tests/test_streaming_rate_cap.py +108 -0
- package/.claude/hooks/tests/test_subagent_dispatch.py +248 -0
- package/.claude/hooks/tests/test_subagent_model_override_removed.py +108 -0
- package/.claude/hooks/tests/test_team.py +95 -0
- package/.claude/hooks/tests/test_template_dogfood_parity.py +106 -0
- package/.claude/hooks/tests/test_terminal_compress.py +135 -0
- package/.claude/hooks/tests/test_test_env_context_agent_binding.py +140 -0
- package/.claude/hooks/tests/test_testing_helper.py +53 -0
- package/.claude/hooks/tests/test_thinking_budget_command.py +229 -0
- package/.claude/hooks/tests/test_tier_policy_agent_frontmatter.py +421 -0
- package/.claude/hooks/tests/test_tier_policy_agent_frontmatter_disposition.py +175 -0
- package/.claude/hooks/tests/test_tier_policy_constants.py +336 -0
- package/.claude/hooks/tests/test_tier_policy_loader.py +544 -0
- package/.claude/hooks/tests/test_tier_policy_loader_fallback_observed.py +169 -0
- package/.claude/hooks/tests/test_tier_policy_types.py +270 -0
- package/.claude/hooks/tests/test_tokens_lib.py +118 -0
- package/.claude/hooks/tests/test_tool_lifecycle.py +598 -0
- package/.claude/hooks/tests/test_tool_lifecycle_perf.py +110 -0
- package/.claude/hooks/tests/test_turbo_profile.py +28 -0
- package/.claude/hooks/tests/test_turbo_sessionstart.py +79 -0
- package/.claude/hooks/tests/test_two_writer_chain.py +175 -0
- package/.claude/hooks/tests/test_upgrade_retry.py +346 -0
- package/.claude/hooks/tests/test_user_prompt_submit.py +254 -0
- package/.claude/hooks/tests/test_user_prompt_submit_salt.py +204 -0
- package/.claude/hooks/tests/test_verify_after_edit.py +100 -0
- package/.claude/hooks/tests/test_veto_floor_bijection.py +174 -0
- package/.claude/hooks/tests/test_w5_cookbook_remediation.py +712 -0
- package/.claude/hooks/tests/test_w5_scrub_enforcement.py +371 -0
- package/.claude/hooks/tests/test_webfetch_injection.py +280 -0
- package/.claude/hooks/tests/test_wiredeadmod_estimation_wiring.py +283 -0
- package/.claude/hooks/tests/test_wiredeadmod_spawn_wiring.py +303 -0
- package/.claude/hooks/tests/test_worktree_writer.py +509 -0
- package/.claude/hooks/turbo_profile.py +554 -0
- package/.claude/hooks/turbo_sessionstart.py +472 -0
- package/.claude/hooks/verify_after_edit.py +281 -0
- package/.claude/pitfalls-catalog.yaml +150 -0
- package/.claude/plans/AUDIT-LOG-SCHEMA.md +548 -0
- package/.claude/plans/DEBATE-SCHEMA.md +539 -0
- package/.claude/plans/PLAN-128/AB-PROTOCOL.md +121 -0
- package/.claude/plans/PLAN-128/measure-state.sh +101 -0
- package/.claude/plans/PLAN-139-canonical-invariants-and-debt-ledger.md +253 -0
- package/.claude/plans/PLAN-140/architect/round-1/approved.md +40 -0
- package/.claude/plans/PLAN-140-compaction-hook-origin-dropfix.md +95 -0
- package/.claude/plans/PLAN-141/architect/round-1/approved.md +28 -0
- package/.claude/plans/PLAN-141-mcp-smoke-staging-ruff-tolerance.md +72 -0
- package/.claude/plans/PLAN-142/architect/round-1/anonymization-map.md +11 -0
- package/.claude/plans/PLAN-142/architect/round-1/consensus.md +95 -0
- package/.claude/plans/PLAN-142/architect/round-1/devops-engineer.md +57 -0
- package/.claude/plans/PLAN-142/architect/round-1/proposal.md +57 -0
- package/.claude/plans/PLAN-142/architect/round-1/security-engineer.md +55 -0
- package/.claude/plans/PLAN-142/architect/round-1/vp-engineering.md +58 -0
- package/.claude/plans/PLAN-142/architect/round-2/anonymization-map.md +11 -0
- package/.claude/plans/PLAN-142/architect/round-2/approved.md +65 -0
- package/.claude/plans/PLAN-142/architect/round-2/consensus.md +78 -0
- package/.claude/plans/PLAN-142/architect/round-2/devops-engineer.md +58 -0
- package/.claude/plans/PLAN-142/architect/round-2/security-engineer.md +56 -0
- package/.claude/plans/PLAN-142/architect/round-2/vp-engineering.md +54 -0
- package/.claude/plans/PLAN-142/staging/EXECUTION-RUNBOOK.md +74 -0
- package/.claude/plans/PLAN-142/staging/STAGING-NOTES.md +63 -0
- package/.claude/plans/PLAN-142/staging/check_pair_rail__invoke_and_consume.py.txt +644 -0
- package/.claude/plans/PLAN-142/staging/codex_adapter_parsers.py.txt +677 -0
- package/.claude/plans/PLAN-142/staging/codex_cli_shape.py +433 -0
- package/.claude/plans/PLAN-142-codex-cli-0139-adapter-migration.md +224 -0
- package/.claude/plans/PLAN-143/architect/round-1/anonymization-map.md +22 -0
- package/.claude/plans/PLAN-143/architect/round-1/consensus.md +108 -0
- package/.claude/plans/PLAN-143/architect/round-1/devops-engineer.md +228 -0
- package/.claude/plans/PLAN-143/architect/round-1/proposal.md +48 -0
- package/.claude/plans/PLAN-143/architect/round-1/security-engineer.md +224 -0
- package/.claude/plans/PLAN-143/architect/round-1/vp-engineering.md +166 -0
- package/.claude/plans/PLAN-143/patches/PLAN143-item1-env-inventory.NOTE.md +106 -0
- package/.claude/plans/PLAN-143/patches/PLAN143-item2-spool-writer-rotate-guard.patch +41 -0
- package/.claude/plans/PLAN-143/patches/PLAN143-item3-audit-emit-exit-code.patch +32 -0
- package/.claude/plans/PLAN-143-repo-hygiene-debt.md +201 -0
- package/.claude/plans/PLAN-SCHEMA.md +870 -0
- package/.claude/plans/README.md +208 -0
- package/.claude/plans/examples/debate-round-1/consensus.md +166 -0
- package/.claude/plans/examples/debate-round-1/devops-engineer.md +133 -0
- package/.claude/plans/examples/debate-round-1/proposal.md +66 -0
- package/.claude/plans/examples/debate-round-1/security-engineer.md +109 -0
- package/.claude/plans/examples/debate-round-1/vp-engineering.md +110 -0
- package/.claude/policies/.drift-manifest.json +16 -0
- package/.claude/policies/bash-safety.policy.yaml +37 -0
- package/.claude/policies/fixtures/.gitkeep +0 -0
- package/.claude/policies/fixtures/bash-safety.fixtures.jsonl +46 -0
- package/.claude/policies/fixtures/plan-edit.fixtures.jsonl +36 -0
- package/.claude/policies/grandfather-cap.policy.yaml +85 -0
- package/.claude/policies/plan-edit.policy.yaml +152 -0
- package/.claude/policies/rubric-violation-catalogue.yaml +187 -0
- package/.claude/policies/schemas/repo-profile-skill-binding.schema.json +126 -0
- package/.claude/policies/schemas/repo-profile.schema.json +83 -0
- package/.claude/policies/schemas/squad-bundle-frontmatter.schema.json +152 -0
- package/.claude/policies/secret-patterns-exchange.yaml +368 -0
- package/.claude/policies/smart-loading-cap-table.yaml +34 -0
- package/.claude/proposals/.gitkeep +0 -0
- package/.claude/proposals/README.md +42 -0
- package/.claude/proposals/SP-001-code-review-checklist-2026-04-20.md +65 -0
- package/.claude/proposals/SP-001-code-review-checklist-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-002-security-and-auth-2026-04-20.md +74 -0
- package/.claude/proposals/SP-002-security-and-auth-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-003-design-system-and-components-2026-04-20.md +67 -0
- package/.claude/proposals/SP-003-design-system-and-components-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-004-accessibility-and-wcag-2026-04-20.md +68 -0
- package/.claude/proposals/SP-004-accessibility-and-wcag-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-005-ux-and-user-journeys-2026-04-20.md +63 -0
- package/.claude/proposals/SP-005-ux-and-user-journeys-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-006-chaos-and-resilience-2026-04-20.md +79 -0
- package/.claude/proposals/SP-006-chaos-and-resilience-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-007-ai-llm-orchestration-2026-04-20.md +76 -0
- package/.claude/proposals/SP-007-ai-llm-orchestration-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-008-performance-engineering-2026-04-20.md +82 -0
- package/.claude/proposals/SP-008-performance-engineering-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-009-code-review-checklist-2026-04-20.md +76 -0
- package/.claude/proposals/SP-009-code-review-checklist-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-010-accessibility-and-wcag-adopter-note-2026-04-20.md +77 -0
- package/.claude/proposals/SP-010-accessibility-and-wcag-adopter-note-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-011-design-system-and-components-adopter-note-2026-04-20.md +79 -0
- package/.claude/proposals/SP-011-design-system-and-components-adopter-note-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-012-ux-and-user-journeys-adopter-note-2026-04-20.md +83 -0
- package/.claude/proposals/SP-012-ux-and-user-journeys-adopter-note-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-013-frontend-performance-optimization-2026-04-20.md +82 -0
- package/.claude/proposals/SP-013-frontend-performance-optimization-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-014-observability-and-ops-2026-04-20.md +80 -0
- package/.claude/proposals/SP-014-observability-and-ops-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-015-testing-strategy-2026-04-20.md +87 -0
- package/.claude/proposals/SP-015-testing-strategy-2026-04-20.md.asc +8 -0
- package/.claude/proposals/SP-016-code-review-checklist-fluency-rubric-2026-04-28.md +111 -0
- package/.claude/proposals/SP-016-code-review-checklist-fluency-rubric-2026-04-28.md.asc +8 -0
- package/.claude/proposals/SP-017-chaos-and-resilience-adopter-note-2026-04-28.md +87 -0
- package/.claude/proposals/SP-017-chaos-and-resilience-adopter-note-2026-04-28.md.asc +8 -0
- package/.claude/proposals/SP-018-ceo-orchestration-inventory-regen-2026-04-21.md +64 -0
- package/.claude/proposals/SP-018-ceo-orchestration-inventory-regen-2026-04-21.md.asc +8 -0
- package/.claude/proposals/SP-019-terse-mode-2026-04-21.md +107 -0
- package/.claude/proposals/SP-019-terse-mode-2026-04-21.md.asc +8 -0
- package/.claude/proposals/SP-020-ceo-orchestration-audit-tokens-2026-04-21.md +74 -0
- package/.claude/proposals/SP-020-ceo-orchestration-audit-tokens-2026-04-21.md.asc +8 -0
- package/.claude/proposals/SP-021-ceo-orchestration-autonomous-loop-2026-04-21.md +71 -0
- package/.claude/proposals/SP-021-ceo-orchestration-autonomous-loop-2026-04-21.md.asc +8 -0
- package/.claude/rag/_index_core.py +344 -0
- package/.claude/rag/indexignore +101 -0
- package/.claude/rag/install-sidecar.sh +275 -0
- package/.claude/rag/models.manifest.json +19 -0
- package/.claude/rag/requirements.lock +40 -0
- package/.claude/rag/sidecar-config.template.json +53 -0
- package/.claude/rag/tests/test_index_core.py +262 -0
- package/.claude/rag/tests/test_install_sidecar.sh +132 -0
- package/.claude/scripts/.known_actions_floor.lock +0 -0
- package/.claude/scripts/admin-invite.py +199 -0
- package/.claude/scripts/adopter-metrics.py +712 -0
- package/.claude/scripts/aek-calibration-c2.py +253 -0
- package/.claude/scripts/aek-calibration-c3.py +382 -0
- package/.claude/scripts/aggregate-changesets.py +350 -0
- package/.claude/scripts/architect-bundle-validate.py +227 -0
- package/.claude/scripts/audit-dashboard.py +1320 -0
- package/.claude/scripts/audit-log-labels.jsonl +0 -0
- package/.claude/scripts/audit-log-retain.py +404 -0
- package/.claude/scripts/audit-query.py +3333 -0
- package/.claude/scripts/audit-telemetry.py +337 -0
- package/.claude/scripts/audit-tokens.py +502 -0
- package/.claude/scripts/audit-verify-chain.py +537 -0
- package/.claude/scripts/backup-audit.py +247 -0
- package/.claude/scripts/benchmark/plan-071-import-floor/README.md +194 -0
- package/.claude/scripts/benchmark/plan-071-import-floor/fixtures/baseline.json +1 -0
- package/.claude/scripts/benchmark/plan-071-import-floor/fixtures/expected_quantiles.json +11 -0
- package/.claude/scripts/benchmark/plan-071-import-floor/import_floor_bench.py +791 -0
- package/.claude/scripts/benchmark/plan-071-import-floor/run_bench.sh +180 -0
- package/.claude/scripts/benchmark-fallback-scorer.py +254 -0
- package/.claude/scripts/benchmark-judge.py +621 -0
- package/.claude/scripts/budget-summary.py +946 -0
- package/.claude/scripts/build-canonical-models.py +645 -0
- package/.claude/scripts/calibration-kappa.py +262 -0
- package/.claude/scripts/cc-analytics-pull.py +393 -0
- package/.claude/scripts/ceo-backup.sh +307 -0
- package/.claude/scripts/ceo-boot.py +3017 -0
- package/.claude/scripts/ceo-cost.py +1116 -0
- package/.claude/scripts/ceo-diagnose.py +486 -0
- package/.claude/scripts/ceo-escalation-detector.py +743 -0
- package/.claude/scripts/ceo-health.py +584 -0
- package/.claude/scripts/ceo-info.py +1001 -0
- package/.claude/scripts/ceo-restore.sh +215 -0
- package/.claude/scripts/chaos-inject.py +439 -0
- package/.claude/scripts/check-action-sha-drift.py +275 -0
- package/.claude/scripts/check-active-hooks-executable.py +119 -0
- package/.claude/scripts/check-adr-chain.py +617 -0
- package/.claude/scripts/check-audit-action-name-convention.py +221 -0
- package/.claude/scripts/check-audit-hmac-null.py +253 -0
- package/.claude/scripts/check-audit-read-api-stable.py +239 -0
- package/.claude/scripts/check-audit-registry-coverage.py +999 -0
- package/.claude/scripts/check-auto-activation-flags.py +180 -0
- package/.claude/scripts/check-canonical-doc-freshness.py +222 -0
- package/.claude/scripts/check-claude-md-claims.py +346 -0
- package/.claude/scripts/check-confidence-gate-drift.py +295 -0
- package/.claude/scripts/check-conformance-harness-mapping.py +503 -0
- package/.claude/scripts/check-contamination.sh +25 -0
- package/.claude/scripts/check-creative-rewrite.py +596 -0
- package/.claude/scripts/check-debate-round-lifecycle.py +185 -0
- package/.claude/scripts/check-debt-ledger.py +305 -0
- package/.claude/scripts/check-docs-drift.py +259 -0
- package/.claude/scripts/check-docs-freshness.py +487 -0
- package/.claude/scripts/check-flip-criteria-drift.py +426 -0
- package/.claude/scripts/check-flip-release-gate-consistency.py +134 -0
- package/.claude/scripts/check-framework-updates.sh +239 -0
- package/.claude/scripts/check-function-length.py +426 -0
- package/.claude/scripts/check-model-deprecations.py +377 -0
- package/.claude/scripts/check-originator-residue.py +248 -0
- package/.claude/scripts/check-pitfall-regression.sh +153 -0
- package/.claude/scripts/check-policy-drift.py +74 -0
- package/.claude/scripts/check-roadmap-binding.py +170 -0
- package/.claude/scripts/check-rule-invariants.py +385 -0
- package/.claude/scripts/check-sdk-compat.sh +76 -0
- package/.claude/scripts/check-secret-pattern-coverage.py +175 -0
- package/.claude/scripts/check-sidecar-manifest.py +493 -0
- package/.claude/scripts/check-skill-activation-mode.py +41 -0
- package/.claude/scripts/check-skill-health.sh +179 -0
- package/.claude/scripts/check-spec-drift.py +147 -0
- package/.claude/scripts/check-staleness.py +506 -0
- package/.claude/scripts/check-stdlib-only.py +373 -0
- package/.claude/scripts/check-substrate-watch.py +285 -0
- package/.claude/scripts/check-swarm-harness-mapping.py +380 -0
- package/.claude/scripts/check-test-audit-isolation.py +622 -0
- package/.claude/scripts/check-test-env-hygiene.py +509 -0
- package/.claude/scripts/check-threat-model-freshness.py +313 -0
- package/.claude/scripts/check-tier-boundaries.py +233 -0
- package/.claude/scripts/check-tla-schema-drift.py +272 -0
- package/.claude/scripts/check_atlas_fpr.py +595 -0
- package/.claude/scripts/check_contamination.py +337 -0
- package/.claude/scripts/check_known_actions_floor.py +155 -0
- package/.claude/scripts/check_threat_model_coverage.py +214 -0
- package/.claude/scripts/check_translations_drift.py +199 -0
- package/.claude/scripts/codex_invoke.py +436 -0
- package/.claude/scripts/compare-adopters.py +549 -0
- package/.claude/scripts/confidence-gate-backfill.py +261 -0
- package/.claude/scripts/confidence_gate.py +736 -0
- package/.claude/scripts/context-budget.py +1887 -0
- package/.claude/scripts/contextual-recommender.py +815 -0
- package/.claude/scripts/cost-table.yaml +99 -0
- package/.claude/scripts/debate-converge.py +335 -0
- package/.claude/scripts/debate-emit.py +132 -0
- package/.claude/scripts/debate-orchestrate.py +972 -0
- package/.claude/scripts/detect-repo-profile.py +1280 -0
- package/.claude/scripts/detectors/__init__.py +19 -0
- package/.claude/scripts/detectors/looping.py +127 -0
- package/.claude/scripts/detectors/overpowered.py +96 -0
- package/.claude/scripts/detectors/retry_churn.py +119 -0
- package/.claude/scripts/detectors/schema.py +94 -0
- package/.claude/scripts/detectors/tests/__init__.py +0 -0
- package/.claude/scripts/detectors/tests/fixtures.py +420 -0
- package/.claude/scripts/detectors/tests/test_looping.py +124 -0
- package/.claude/scripts/detectors/tests/test_overpowered.py +114 -0
- package/.claude/scripts/detectors/tests/test_retry_churn.py +101 -0
- package/.claude/scripts/detectors/tests/test_schema.py +109 -0
- package/.claude/scripts/detectors/tests/test_tool_cascade.py +131 -0
- package/.claude/scripts/detectors/tests/test_wasteful_thinking.py +112 -0
- package/.claude/scripts/detectors/tests/test_weak_model.py +104 -0
- package/.claude/scripts/detectors/tool_cascade.py +127 -0
- package/.claude/scripts/detectors/wasteful_thinking.py +99 -0
- package/.claude/scripts/detectors/weak_model.py +92 -0
- package/.claude/scripts/env-inventory-check.py +268 -0
- package/.claude/scripts/env-inventory.json +3305 -0
- package/.claude/scripts/extract-skill.py +456 -0
- package/.claude/scripts/fan-plan-parser.py +370 -0
- package/.claude/scripts/find-orphan-sentinels.py +89 -0
- package/.claude/scripts/first-run-wizard.py +1151 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/.env.example +1 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/exchanges/binance.py +3 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/exchanges/coinbase.py +3 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/package.json +5 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/strategies/grid.py +3 -0
- package/.claude/scripts/fixtures/cloned-trading-repo/strategies/pairs.py +3 -0
- package/.claude/scripts/fixtures/missing-package-manifest/README.md +3 -0
- package/.claude/scripts/fixtures/missing-package-manifest/src/main.py +1 -0
- package/.claude/scripts/fixtures/mixed-frontend-backend/package.json +9 -0
- package/.claude/scripts/fixtures/mixed-frontend-backend/requirements.txt +2 -0
- package/.claude/scripts/fixtures/mixed-frontend-backend/src/api/handler.py +2 -0
- package/.claude/scripts/fixtures/mixed-frontend-backend/src/pages/index.tsx +1 -0
- package/.claude/scripts/fixtures/monorepo/apps/app-a/README.md +1 -0
- package/.claude/scripts/fixtures/monorepo/apps/app-b/index.ts +1 -0
- package/.claude/scripts/fixtures/monorepo/package.json +5 -0
- package/.claude/scripts/fixtures/monorepo/packages/lib-a/index.js +1 -0
- package/.claude/scripts/fixtures/monorepo/packages/lib-b/index.js +1 -0
- package/.claude/scripts/fixtures/monorepo/pnpm-workspace.yaml +3 -0
- package/.claude/scripts/fixtures/persona-coverage-expected-thresholds.yaml +20 -0
- package/.claude/scripts/flip-criteria-drift-allowlist.txt +31 -0
- package/.claude/scripts/generate-adr-index.py +339 -0
- package/.claude/scripts/generate-available-models.py +280 -0
- package/.claude/scripts/generate-dispatch.py +430 -0
- package/.claude/scripts/generate-sbom.py +287 -0
- package/.claude/scripts/generate-skill-inventory.sh +193 -0
- package/.claude/scripts/github-api-client.py +297 -0
- package/.claude/scripts/goap-planner.py +742 -0
- package/.claude/scripts/hook-profiler.py +671 -0
- package/.claude/scripts/import-skill.py +569 -0
- package/.claude/scripts/import_ui_ux_pro_max.py +137 -0
- package/.claude/scripts/inject-agent-context.sh +948 -0
- package/.claude/scripts/k-calibration.py +456 -0
- package/.claude/scripts/key-hygiene.py +511 -0
- package/.claude/scripts/lesson-restore.py +171 -0
- package/.claude/scripts/lesson_ranker.py +100 -0
- package/.claude/scripts/lessons.py +883 -0
- package/.claude/scripts/lint-skills.py +555 -0
- package/.claude/scripts/local/README.md +280 -0
- package/.claude/scripts/local/check-doc-skill-paths.sh +124 -0
- package/.claude/scripts/local/dependency-graph.py +684 -0
- package/.claude/scripts/local/estimate-calibrator.py +240 -0
- package/.claude/scripts/local/findings-pretty-print.py +78 -0
- package/.claude/scripts/local/generate-ceremony.sh +558 -0
- package/.claude/scripts/local/pair-rail-gate.sh +156 -0
- package/.claude/scripts/local/release-dry-run.py +853 -0
- package/.claude/scripts/local/tests/test_dependency_graph.py +364 -0
- package/.claude/scripts/local/tests/test_generate_ceremony.sh +144 -0
- package/.claude/scripts/local/tests/test_release_dry_run.py +743 -0
- package/.claude/scripts/local/validate-findings.py +168 -0
- package/.claude/scripts/local/validate-saved-workflows.js +69 -0
- package/.claude/scripts/local/verify-counts.sh +420 -0
- package/.claude/scripts/local/verify-scope-coverage.py +205 -0
- package/.claude/scripts/local/verify-staging-manifest.py +188 -0
- package/.claude/scripts/local/wave-readonly-monitor.py +271 -0
- package/.claude/scripts/log-friction.sh +290 -0
- package/.claude/scripts/mcp/code_nav_bridge.py +259 -0
- package/.claude/scripts/mcp-server/__init__.py +16 -0
- package/.claude/scripts/mcp-server/auth.py +333 -0
- package/.claude/scripts/mcp-server/cost.py +108 -0
- package/.claude/scripts/mcp-server/dispatch.py +853 -0
- package/.claude/scripts/mcp-server/handlers/__init__.py +16 -0
- package/.claude/scripts/mcp-server/handlers/audit_query.py +384 -0
- package/.claude/scripts/mcp-server/handlers/get_audit_log.py +163 -0
- package/.claude/scripts/mcp-server/handlers/get_cost_budget.py +130 -0
- package/.claude/scripts/mcp-server/handlers/get_debate_state.py +207 -0
- package/.claude/scripts/mcp-server/handlers/get_skill.py +199 -0
- package/.claude/scripts/mcp-server/handlers/list_agents.py +236 -0
- package/.claude/scripts/mcp-server/handlers/list_pitfalls.py +192 -0
- package/.claude/scripts/mcp-server/handlers/list_skills.py +197 -0
- package/.claude/scripts/mcp-server/handlers/plan_status.py +489 -0
- package/.claude/scripts/mcp-server/handlers/server_capabilities.py +127 -0
- package/.claude/scripts/mcp-server/handlers/spawn_agent.py +274 -0
- package/.claude/scripts/mcp-server/http_transport.py +373 -0
- package/.claude/scripts/mcp-server/rate_limit.py +345 -0
- package/.claude/scripts/mcp-server/server.py +212 -0
- package/.claude/scripts/mcp-server/start-mcp-server.sh +111 -0
- package/.claude/scripts/mcp-server/stdio_transport.py +150 -0
- package/.claude/scripts/mcp-server/tests/__init__.py +1 -0
- package/.claude/scripts/mcp-server/tests/test_auth.py +454 -0
- package/.claude/scripts/mcp-server/tests/test_cost.py +122 -0
- package/.claude/scripts/mcp-server/tests/test_dispatch.py +448 -0
- package/.claude/scripts/mcp-server/tests/test_dispatch_bearer_replay_wire.py +358 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_get_audit_log.py +107 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_get_skill.py +108 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_list_agents.py +92 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_list_pitfalls.py +103 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_list_skills.py +121 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_server_capabilities.py +128 -0
- package/.claude/scripts/mcp-server/tests/test_handlers_spawn_agent.py +275 -0
- package/.claude/scripts/mcp-server/tests/test_http_transport.py +418 -0
- package/.claude/scripts/mcp-server/tests/test_rate_limit.py +239 -0
- package/.claude/scripts/mcp-server/tests/test_server.py +125 -0
- package/.claude/scripts/mcp-server/tests/test_stdio_transport.py +196 -0
- package/.claude/scripts/mcp-soak-monitor.py +224 -0
- package/.claude/scripts/memory-prioritize.py +516 -0
- package/.claude/scripts/migrate-grandfather-to-sha256.py +384 -0
- package/.claude/scripts/model-deprecations.json +165 -0
- package/.claude/scripts/morning-ceremony.py +266 -0
- package/.claude/scripts/morning_ledger.py +446 -0
- package/.claude/scripts/mutation-floors.yaml +51 -0
- package/.claude/scripts/mutation-test.py +506 -0
- package/.claude/scripts/nightly-proposals.py +210 -0
- package/.claude/scripts/optimizer/__init__.py +46 -0
- package/.claude/scripts/optimizer/_codex_redaction.py +101 -0
- package/.claude/scripts/optimizer/_skeleton.py +137 -0
- package/.claude/scripts/optimizer/codex_phase_gate.py +257 -0
- package/.claude/scripts/optimizer/complexity_gate.py +208 -0
- package/.claude/scripts/optimizer/fanout.py +249 -0
- package/.claude/scripts/optimizer/model_choice.py +151 -0
- package/.claude/scripts/optimizer/model_normalize.py +118 -0
- package/.claude/scripts/optimizer/rag_recommender.py +110 -0
- package/.claude/scripts/optimizer/recommender.py +213 -0
- package/.claude/scripts/optimizer/tests/__init__.py +0 -0
- package/.claude/scripts/optimizer/tests/test_codex_phase_gate.py +314 -0
- package/.claude/scripts/optimizer/tests/test_codex_review_invoked_emission.py +225 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_complexity_gate.py +122 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_fanout.py +134 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_model_choice.py +124 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_model_normalize.py +155 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_rag_recommender.py +190 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_recommender.py +131 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_skeleton.py +117 -0
- package/.claude/scripts/optimizer/tests/test_optimizer_types.py +53 -0
- package/.claude/scripts/optimizer/types.py +122 -0
- package/.claude/scripts/osv_check.py +559 -0
- package/.claude/scripts/otel-export.py +329 -0
- package/.claude/scripts/otel-local-sink.py +470 -0
- package/.claude/scripts/persona_demand_resolver.py +658 -0
- package/.claude/scripts/persona_demand_scan.py +382 -0
- package/.claude/scripts/persona_waive_parser.py +127 -0
- package/.claude/scripts/pitfall-query.py +218 -0
- package/.claude/scripts/plan-tokens.py +843 -0
- package/.claude/scripts/policy-shadow-runner.py +445 -0
- package/.claude/scripts/predict-budget/predict-plan-cost.py +581 -0
- package/.claude/scripts/predict-budget/tests/test_predict_plan_cost.py +375 -0
- package/.claude/scripts/profile-opus-4-7.py +557 -0
- package/.claude/scripts/prune-lessons.py +453 -0
- package/.claude/scripts/rate-card-calibrate.py +283 -0
- package/.claude/scripts/rate-card-fixtures.json +18 -0
- package/.claude/scripts/reality-ledger.py +2175 -0
- package/.claude/scripts/red-team-corpus/.byte-identity-check.txt +86 -0
- package/.claude/scripts/red-team-corpus/README.md +132 -0
- package/.claude/scripts/red-team-corpus/external/EXT-001-prompt-inject.md +24 -0
- package/.claude/scripts/red-team-corpus/external/EXT-002-hackaprompt.md +25 -0
- package/.claude/scripts/red-team-corpus/external/EXT-003-gcg.md +31 -0
- package/.claude/scripts/red-team-corpus/external/EXT-004-tap.md +23 -0
- package/.claude/scripts/red-team-corpus/external/EXT-005-cybersecurity-eval.md +30 -0
- package/.claude/scripts/red-team-corpus/external/EXT-006-anthropic-samples.md +26 -0
- package/.claude/scripts/red-team-corpus/external/EXT-007-trojan-source.md +26 -0
- package/.claude/scripts/red-team-corpus/external/EXT-008-owasp-llm-top10.md +33 -0
- package/.claude/scripts/red-team-corpus/external/EXT-009-jailbreak-bench.md +24 -0
- package/.claude/scripts/red-team-corpus/external/EXT-010-advbench.md +22 -0
- package/.claude/scripts/red-team-corpus/external/EXT-011-mitre-atlas.md +25 -0
- package/.claude/scripts/red-team-corpus/external/EXT-012-npm-typosquat.md +23 -0
- package/.claude/scripts/red-team-corpus/external/EXT-013-log-tamper-poc.md +25 -0
- package/.claude/scripts/red-team-corpus/external/EXT-014-cwe-798-credentials.md +24 -0
- package/.claude/scripts/red-team-corpus/external/EXT-015-garak.md +28 -0
- package/.claude/scripts/red-team-corpus/external/EXT-016-skill-content-injection-via-markdown.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-017-persona-impersonation-ceo.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-018-file-assignment-wildcard-escape.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-019-veto-bypass-force-proceed.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-020-canonical-edit-circumvent-settings.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-021-spawn-without-agent-profile.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-022-hidden-unicode-in-skill-name.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-023-mcp-spawn-governance-bypass.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-024-adapter-credential-in-error-trace.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-025-sandbox-escape-nested-subshell.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-026-plan-edit-without-debate.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-027-audit-log-rotation-race.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-028-npm-dependency-confusion.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-029-output-safety-unicode-confusable.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-030-adapter-retry-storm-dos.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-031-team-md-direct-edit.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-032-sandbox-env-var-exfil.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-033-mcp-rate-limit-bypass-headers.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-034-otel-span-attribute-leak.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-035-skill-patch-polyglot-payload.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-036-output-safety-base64-triple-wrap.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-037-plan-id-cross-plan-memory-read.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-038-npm-slsa-provenance-strip.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-039-adapter-exfil-streaming-chunk.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/EXT-040-sandbox-symlink-to-secrets.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/external/README.md +63 -0
- package/.claude/scripts/red-team-corpus/flake-budget.yaml +244 -0
- package/.claude/scripts/red-team-corpus/provenance.md +74 -0
- package/.claude/scripts/red-team-corpus/regression/REG-001-s3-audit-emission-gap.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-002-audit-registry-miss.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-003-breaker-provider-kwarg-missing.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-004-canonical-edit-conftest-block.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-005-mcp-dispatch-oversized-handler.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-006-audit-registry-false-orphan.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-007-spec-count-undercount.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-008-adr-reserved-slot-phantom.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-009-tlc-pending-placeholder.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-010-mutation-kill-rate-fake.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-011-byte-identity-governance-persona.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-012-conformance-mapping-partial-path.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-013-l1-fairness-lazy-fire.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-014-mcp-path-traversal-skill.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/regression/REG-015-mcp-hmac-timestamp-skew.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-001-skill-patch-bidi-trojan.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-002-skill-patch-zero-width-smuggle.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-003-skill-patch-exec-smuggled-fence.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-004-skill-patch-oversized-diff.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-005-audit-log-byte-rewrite.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-006-audit-log-truncation.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-007-audit-log-lock-race.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-008-plan-id-env-spoof.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-009-plan-id-frontmatter-hijack.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-010-plan-id-cross-plan-read.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-011-sandbox-escape-curl-exfil.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-012-sandbox-escape-env-dump.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-013-sandbox-escape-symlink-plant.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-014-mcp-handler-governance-bypass.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-015-mcp-handler-acl-enumeration.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-016-mcp-handler-rate-limit-evasion.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-017-adapter-exfil-via-error-message.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-018-adapter-exfil-otel-attr.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-019-adapter-exfil-retry-replay.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-020-output-safety-nfkc-bypass.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-021-output-safety-base64-double-wrap.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-022-output-safety-entropy-below-threshold.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-023-output-safety-regex-obfuscation.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-024-output-safety-luhn-partial.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-025-npm-tamper-supply-chain.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-026-npm-tamper-typo-squat.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/synthetic/SYN-027-npm-tamper-unsigned-slsa.jsonl +1 -0
- package/.claude/scripts/red-team-corpus/v1/fixtures.jsonl +67 -0
- package/.claude/scripts/red-team-corpus/v1/fixtures.jsonl.sha256 +1 -0
- package/.claude/scripts/red-team-corpus/v1/labels.json +88 -0
- package/.claude/scripts/red-team-eval.py +1099 -0
- package/.claude/scripts/registry.py +438 -0
- package/.claude/scripts/replay/__init__.py +0 -0
- package/.claude/scripts/replay/replay-session.py +1232 -0
- package/.claude/scripts/replay/tests/__init__.py +0 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/api-key-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/cpf-cnpj-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/email-in-log-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/homoglyph-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/jwt-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/os-path-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-01-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-02-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-03-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-04-positive.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-05-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-06-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-07-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/fixtures/pan-08-negative.jsonl +1 -0
- package/.claude/scripts/replay/tests/test_replay_redact_lib.py +971 -0
- package/.claude/scripts/replay/tests/test_replay_session.py +396 -0
- package/.claude/scripts/replay/tests/test_replay_session_capture.py +522 -0
- package/.claude/scripts/repo-profile.schema.json +83 -0
- package/.claude/scripts/run-promotion-gate.py +631 -0
- package/.claude/scripts/run-skill-benchmark.py +1276 -0
- package/.claude/scripts/scan-injection-strict.sh +162 -0
- package/.claude/scripts/scan-injection.py +305 -0
- package/.claude/scripts/scan-upstream-injection.py +663 -0
- package/.claude/scripts/scratchpad.py +427 -0
- package/.claude/scripts/self_test.py +602 -0
- package/.claude/scripts/session-graph-build.py +728 -0
- package/.claude/scripts/session-resume.py +363 -0
- package/.claude/scripts/set-quality-profile.sh +229 -0
- package/.claude/scripts/skill-budget-generator.py +599 -0
- package/.claude/scripts/skill-import-rubric.py +368 -0
- package/.claude/scripts/skill-index-build.py +534 -0
- package/.claude/scripts/skill-patch-apply.py +1088 -0
- package/.claude/scripts/skill-patch-propose.py +690 -0
- package/.claude/scripts/skill-retrieve.py +522 -0
- package/.claude/scripts/skill_grandfather_parser.py +295 -0
- package/.claude/scripts/smart-loading-resolver.py +994 -0
- package/.claude/scripts/spot-check-findings.py +211 -0
- package/.claude/scripts/squad-export.py +437 -0
- package/.claude/scripts/squad-import.py +741 -0
- package/.claude/scripts/status.py +315 -0
- package/.claude/scripts/statusline-ceo.py +597 -0
- package/.claude/scripts/substrate-watch.json +54 -0
- package/.claude/scripts/success-receipt.py +1038 -0
- package/.claude/scripts/swarm/__init__.py +42 -0
- package/.claude/scripts/swarm/_benchmark_replay.py +259 -0
- package/.claude/scripts/swarm/_child_isolation.py +113 -0
- package/.claude/scripts/swarm/_coordinator_sim.py +293 -0
- package/.claude/scripts/swarm/_governors.py +277 -0
- package/.claude/scripts/swarm/_integration.py +547 -0
- package/.claude/scripts/swarm/_parent_death.py +176 -0
- package/.claude/scripts/swarm/_process_group.py +250 -0
- package/.claude/scripts/swarm/_replay_tournament.py +214 -0
- package/.claude/scripts/swarm/_spawn_gate.py +292 -0
- package/.claude/scripts/swarm/_subagent_fabrication.py +444 -0
- package/.claude/scripts/swarm/_worktree_pool.py +276 -0
- package/.claude/scripts/swarm/coordinator.py +543 -0
- package/.claude/scripts/swarm/file_assignment.py +111 -0
- package/.claude/scripts/swarm/fixtures/mcp_corpus.json +111 -0
- package/.claude/scripts/swarm/kill_switch.py +260 -0
- package/.claude/scripts/swarm/loop_runner.py +486 -0
- package/.claude/scripts/swarm/recovery.py +178 -0
- package/.claude/scripts/swarm/test_mcp_injection_repro.py +518 -0
- package/.claude/scripts/swarm/test_rail_anomaly_repro.py +586 -0
- package/.claude/scripts/swarm/tests/__init__.py +1 -0
- package/.claude/scripts/swarm/tests/test_benchmark_manifest_schema.py +227 -0
- package/.claude/scripts/swarm/tests/test_benchmark_replay.py +248 -0
- package/.claude/scripts/swarm/tests/test_child_isolation.py +138 -0
- package/.claude/scripts/swarm/tests/test_coordinator.py +289 -0
- package/.claude/scripts/swarm/tests/test_coordinator_production_integration.py +434 -0
- package/.claude/scripts/swarm/tests/test_coordinator_sim.py +192 -0
- package/.claude/scripts/swarm/tests/test_coordinator_tick.py +165 -0
- package/.claude/scripts/swarm/tests/test_file_assignment.py +100 -0
- package/.claude/scripts/swarm/tests/test_governors.py +269 -0
- package/.claude/scripts/swarm/tests/test_integration.py +344 -0
- package/.claude/scripts/swarm/tests/test_kill_switch.py +307 -0
- package/.claude/scripts/swarm/tests/test_loop_runner.py +168 -0
- package/.claude/scripts/swarm/tests/test_loop_runner_circuit_breaker.py +555 -0
- package/.claude/scripts/swarm/tests/test_loop_runner_gate_enforcement.py +304 -0
- package/.claude/scripts/swarm/tests/test_loop_runner_gate_kill_switch.py +147 -0
- package/.claude/scripts/swarm/tests/test_loop_runner_sentinel_revocation_slo.py +112 -0
- package/.claude/scripts/swarm/tests/test_optimizer_killswitch.py +205 -0
- package/.claude/scripts/swarm/tests/test_parent_death.py +128 -0
- package/.claude/scripts/swarm/tests/test_parent_death_integration.py +305 -0
- package/.claude/scripts/swarm/tests/test_process_group.py +132 -0
- package/.claude/scripts/swarm/tests/test_process_group_reap.py +212 -0
- package/.claude/scripts/swarm/tests/test_rail_anomaly_repro.py +516 -0
- package/.claude/scripts/swarm/tests/test_recovery.py +165 -0
- package/.claude/scripts/swarm/tests/test_replay_tournament.py +284 -0
- package/.claude/scripts/swarm/tests/test_spawn_gate.py +265 -0
- package/.claude/scripts/swarm/tests/test_subagent_fabrication.py +824 -0
- package/.claude/scripts/swarm/tests/test_swarm_activation_smoke.py +112 -0
- package/.claude/scripts/swarm/tests/test_tournament.py +195 -0
- package/.claude/scripts/swarm/tests/test_worktree_pool.py +252 -0
- package/.claude/scripts/swarm/tournament.py +261 -0
- package/.claude/scripts/task-route.py +807 -0
- package/.claude/scripts/test-env-hygiene-allowlist.yaml +1093 -0
- package/.claude/scripts/tests/DEFERRED.md +99 -0
- package/.claude/scripts/tests/conftest.py +42 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/bad-type.md +4 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/missing-frontmatter.md +1 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/multidoc.md +6 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/sample-CHANGELOG.md +29 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/second-minor.md +4 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/single-patch.md +4 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/third-major.md +4 -0
- package/.claude/scripts/tests/fixtures/aggregate-changesets/unknown-key.md +6 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/bidi_override.md +12 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/fenced_python.md +19 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/homoglyph.md +11 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/injection.md +11 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/long_line.md +9 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/oversized.md +261 -0
- package/.claude/scripts/tests/fixtures/bad_lessons/zero_width.md +11 -0
- package/.claude/scripts/tests/fixtures/budget_summary/generate_fixtures.py +368 -0
- package/.claude/scripts/tests/fixtures/claims/README.md +21 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/neg-missing.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/neg-no-file.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/pos-extract.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/pos-main.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/pos-verify.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/function_exists/quoted-colon-path.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/import_resolves/codeblock-skipped.txt +8 -0
- package/.claude/scripts/tests/fixtures/claims/import_resolves/neg-blocked-os.txt +6 -0
- package/.claude/scripts/tests/fixtures/claims/import_resolves/neg-relative.txt +5 -0
- package/.claude/scripts/tests/fixtures/claims/import_resolves/pos-dotted.txt +6 -0
- package/.claude/scripts/tests/fixtures/claims/import_resolves/pos-stdlib-like.txt +5 -0
- package/.claude/scripts/tests/fixtures/claims/line_range/neg-missing-file.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/line_range/neg-too-long.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/line_range/pos-large.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/line_range/pos-small.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/line_range/quoted-path.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/codeblock-skipped.txt +7 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-absolute-outside.txt +6 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-dotdot-escape.txt +7 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-imaginary.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-proc-self.txt +6 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-symlink-escape.txt +8 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/neg-typo.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/pos-claude.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/pos-readme.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/path_exists/pos-self.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/sha_exists/neg-fake.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/sha_exists/neg-not-sha.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/sha_exists/pos-head.txt +4 -0
- package/.claude/scripts/tests/fixtures/claims/sha_exists/pos-root.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/sha_exists/pos-short.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/neg-missing-file.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/neg-wrong-test.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/pos-audit-emit.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/pos-extra.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/pos-file.txt +1 -0
- package/.claude/scripts/tests/fixtures/claims/test_passes/quoted-pytest-selector.txt +1 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/converged-pair-1/round-1/a.md +39 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/converged-pair-1/round-1/b.md +36 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/converged-pair-1/round-2/a.md +36 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/converged-pair-1/round-2/b.md +36 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/not-converged-pair-1/round-1/a.md +35 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/not-converged-pair-1/round-1/b.md +34 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/not-converged-pair-1/round-2/a.md +35 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/not-converged-pair-1/round-2/b.md +34 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/partial-overlap/round-1/a.md +35 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/partial-overlap/round-2/a.md +36 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/with-secret/round-1/a.md +36 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/with-secret/round-1/b.md +33 -0
- package/.claude/scripts/tests/fixtures/debate_convergence/with-secret/round-2/a.md +34 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_anchor_only.md +10 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_broken.md +5 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_external_url.md +9 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_in_fenced_code.md +18 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_in_frontmatter.md +10 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_in_html_comment.md +10 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_in_inline_code.md +7 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_in_table.md +6 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_relative_parent.md +7 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/link_url_encoded.md +5 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/real_target.md +3 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/sub/dir.md +3 -0
- package/.claude/scripts/tests/fixtures/docs_freshness/with%20space.md +3 -0
- package/.claude/scripts/tests/fixtures/good_lessons/clean_auth.md +11 -0
- package/.claude/scripts/tests/fixtures/good_lessons/clean_logging.md +11 -0
- package/.claude/scripts/tests/fixtures/good_lessons/clean_retry.md +11 -0
- package/.claude/scripts/tests/fixtures/gpg-keyring-fixture.py +209 -0
- package/.claude/scripts/tests/fixtures/injection/benign-01.txt +8 -0
- package/.claude/scripts/tests/fixtures/injection/benign-02.txt +5 -0
- package/.claude/scripts/tests/fixtures/injection/benign-03.txt +7 -0
- package/.claude/scripts/tests/fixtures/injection/benign-04.txt +9 -0
- package/.claude/scripts/tests/fixtures/injection/benign-05.txt +7 -0
- package/.claude/scripts/tests/fixtures/injection/benign-06.txt +7 -0
- package/.claude/scripts/tests/fixtures/injection/benign-07.txt +11 -0
- package/.claude/scripts/tests/fixtures/injection/benign-08.txt +4 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-01.txt +4 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-02.txt +2 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-03.txt +4 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-04.txt +2 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-05.txt +2 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-06.txt +5 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-07.txt +5 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-08.txt +2 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-09.txt +3 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-10.txt +2 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-11.txt +3 -0
- package/.claude/scripts/tests/fixtures/injection/malicious-12.txt +5 -0
- package/.claude/scripts/tests/fixtures/plan-tokens-calibration/manifest.json +49 -0
- package/.claude/scripts/tests/fixtures/plan-tokens-calibration/plan-051.md +36 -0
- package/.claude/scripts/tests/fixtures/plan-tokens-calibration/plan-052.md +32 -0
- package/.claude/scripts/tests/fixtures/plan-tokens-calibration/plan-058.md +31 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-1-boundary/docs/SAMPLE.md +8 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-1-negative/.claude/scripts/sample.py +12 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-1-negative/docs/SAMPLE.md +4 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-1-positive/.claude/scripts/sample.py +12 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-1-positive/docs/SAMPLE.md +9 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-2-boundary/README.md +4 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-2-negative/.claude/rag/requirements.lock +4 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-2-positive/.claude/rag/requirements.lock +2 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-3-boundary/.claude/agents/devops.md +8 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-3-negative/.claude/agents/devops.md +5 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-3-negative/audit-log.jsonl +2 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-3-positive/.claude/agents/devops.md +7 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-3-positive/audit-log.jsonl +4 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-4-boundary/.claude/adr/ADR-997-fixture-superseded.md +8 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-4-negative/.claude/adr/ADR-998-fixture-negative.md +16 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-4-positive/.claude/adr/ADR-999-fixture-positive.md +15 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-boundary/.claude/hooks/_lib/.do-not-import-from-here +15 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-boundary/.claude/hooks/_lib/audit_emit.py +8 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-boundary/.claude/scripts/dynamic_action.py +12 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-negative/.claude/hooks/_lib/.do-not-import-from-here +15 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-negative/.claude/hooks/_lib/audit_emit.py +11 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-negative/.claude/scripts/registered_emitter.py +8 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-positive/.claude/hooks/_lib/.do-not-import-from-here +15 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-positive/.claude/hooks/_lib/audit_emit.py +12 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/detector-6-positive/.claude/scripts/phantom_emitter.py +13 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/issue-body-template.md +47 -0
- package/.claude/scripts/tests/fixtures/reality-ledger/redaction/_test_corpus.py +7 -0
- package/.claude/scripts/tests/fixtures/repo_profile/cloned-trading-repo/.env.example +5 -0
- package/.claude/scripts/tests/fixtures/repo_profile/cloned-trading-repo/Cargo.toml +9 -0
- package/.claude/scripts/tests/fixtures/repo_profile/cloned-trading-repo/README.md +6 -0
- package/.claude/scripts/tests/fixtures/repo_profile/cloned-trading-repo/exchanges/binance.py +6 -0
- package/.claude/scripts/tests/fixtures/repo_profile/cloned-trading-repo/strategies/triangular.py +4 -0
- package/.claude/scripts/tests/fixtures/repo_profile/missing-package-manifest/README.md +7 -0
- package/.claude/scripts/tests/fixtures/repo_profile/missing-package-manifest/notes.md +1 -0
- package/.claude/scripts/tests/fixtures/repo_profile/mixed-frontend-backend/README.md +6 -0
- package/.claude/scripts/tests/fixtures/repo_profile/mixed-frontend-backend/api/server.js +4 -0
- package/.claude/scripts/tests/fixtures/repo_profile/mixed-frontend-backend/package.json +15 -0
- package/.claude/scripts/tests/fixtures/repo_profile/mixed-frontend-backend/pages/index.tsx +3 -0
- package/.claude/scripts/tests/fixtures/repo_profile/monorepo/README.md +6 -0
- package/.claude/scripts/tests/fixtures/repo_profile/monorepo/apps/backend/.gitkeep +0 -0
- package/.claude/scripts/tests/fixtures/repo_profile/monorepo/apps/frontend/.gitkeep +0 -0
- package/.claude/scripts/tests/fixtures/repo_profile/monorepo/package.json +5 -0
- package/.claude/scripts/tests/fixtures/repo_profile/monorepo/packages/shared/.gitkeep +0 -0
- package/.claude/scripts/tests/fixtures/sample_audit_log.jsonl +50 -0
- package/.claude/scripts/tests/fixtures/siem/.gitkeep +0 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-engine.yaml +8 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-fail-closed.yaml +7 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-fintech.yaml +9 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-frontend.yaml +9 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-generic.yaml +8 -0
- package/.claude/scripts/tests/fixtures/smart_loading/profile-trading-readonly.yaml +9 -0
- package/.claude/scripts/tests/fixtures/smart_loading/synthetic-skill-catalog.yaml +186 -0
- package/.claude/scripts/tests/fixtures/squad_marketplace/.gitkeep +4 -0
- package/.claude/scripts/tests/fixtures/task-route/calibration-holdout.json +49 -0
- package/.claude/scripts/tests/fixtures/task-route/calibration-train.json +174 -0
- package/.claude/scripts/tests/perf/__init__.py +3 -0
- package/.claude/scripts/tests/perf/perf_utils.py +134 -0
- package/.claude/scripts/tests/perf/test_kernel_hard_deny_microbench.py +149 -0
- package/.claude/scripts/tests/perf/test_optimizer_complexity_gate_p99.py +145 -0
- package/.claude/scripts/tests/perf/test_wave_c_canonical_json.py +132 -0
- package/.claude/scripts/tests/perf/test_wave_c_filelock_mkdir.py +71 -0
- package/.claude/scripts/tests/perf/test_wave_c_plan_glob_cache.py +84 -0
- package/.claude/scripts/tests/perf/test_wave_c_preview_collapse.py +98 -0
- package/.claude/scripts/tests/perf/test_wave_c_sys_modules.py +104 -0
- package/.claude/scripts/tests/test_a4_pricing_doctrine.py +127 -0
- package/.claude/scripts/tests/test_admin_invite.py +173 -0
- package/.claude/scripts/tests/test_adopter_metrics.py +723 -0
- package/.claude/scripts/tests/test_aek_calibration_c2.py +107 -0
- package/.claude/scripts/tests/test_aek_calibration_c3.py +192 -0
- package/.claude/scripts/tests/test_aek_state_machine.py +385 -0
- package/.claude/scripts/tests/test_aggregate_changesets.py +646 -0
- package/.claude/scripts/tests/test_architect_bundle_validate.py +159 -0
- package/.claude/scripts/tests/test_audit_dashboard.py +822 -0
- package/.claude/scripts/tests/test_audit_log_dispatch_hint.py +91 -0
- package/.claude/scripts/tests/test_audit_log_retain.py +394 -0
- package/.claude/scripts/tests/test_audit_query.py +1177 -0
- package/.claude/scripts/tests/test_audit_query_by_domain.py +576 -0
- package/.claude/scripts/tests/test_audit_query_claims.py +92 -0
- package/.claude/scripts/tests/test_audit_query_critical.py +267 -0
- package/.claude/scripts/tests/test_audit_query_tokens.py +106 -0
- package/.claude/scripts/tests/test_audit_telemetry.py +214 -0
- package/.claude/scripts/tests/test_audit_tokens.py +255 -0
- package/.claude/scripts/tests/test_audit_verify_chain.py +189 -0
- package/.claude/scripts/tests/test_backup_audit.py +295 -0
- package/.claude/scripts/tests/test_benchmark_fallback_scorer.py +299 -0
- package/.claude/scripts/tests/test_benchmark_judge.py +569 -0
- package/.claude/scripts/tests/test_benchmarks_replay.py +313 -0
- package/.claude/scripts/tests/test_budget_summary.py +628 -0
- package/.claude/scripts/tests/test_build_canonical_models.py +349 -0
- package/.claude/scripts/tests/test_calibration_kappa.py +234 -0
- package/.claude/scripts/tests/test_cc_analytics_pull.py +296 -0
- package/.claude/scripts/tests/test_ceo_backup.py +318 -0
- package/.claude/scripts/tests/test_ceo_boot.py +643 -0
- package/.claude/scripts/tests/test_ceo_boot_audit_emit.py +484 -0
- package/.claude/scripts/tests/test_ceo_boot_enhanced.py +706 -0
- package/.claude/scripts/tests/test_ceo_boot_persona_cadence.py +392 -0
- package/.claude/scripts/tests/test_ceo_boot_plan_082.py +365 -0
- package/.claude/scripts/tests/test_ceo_boot_tamper_tripwires.py +556 -0
- package/.claude/scripts/tests/test_ceo_boot_task_candidate.py +868 -0
- package/.claude/scripts/tests/test_ceo_cost.py +221 -0
- package/.claude/scripts/tests/test_ceo_cost_stream.py +1076 -0
- package/.claude/scripts/tests/test_ceo_diagnose.py +314 -0
- package/.claude/scripts/tests/test_ceo_escalation_detector.py +591 -0
- package/.claude/scripts/tests/test_ceo_health.py +202 -0
- package/.claude/scripts/tests/test_ceo_info.py +542 -0
- package/.claude/scripts/tests/test_chaos_inject_lockdown.py +384 -0
- package/.claude/scripts/tests/test_check_action_sha_drift.py +174 -0
- package/.claude/scripts/tests/test_check_active_hooks_executable.py +79 -0
- package/.claude/scripts/tests/test_check_adr_chain.py +665 -0
- package/.claude/scripts/tests/test_check_audit_hmac_null.py +178 -0
- package/.claude/scripts/tests/test_check_audit_read_api_stable.py +176 -0
- package/.claude/scripts/tests/test_check_audit_registry_coverage.py +744 -0
- package/.claude/scripts/tests/test_check_auto_activation_flags.py +140 -0
- package/.claude/scripts/tests/test_check_canonical_doc_freshness.py +149 -0
- package/.claude/scripts/tests/test_check_claude_md_claims.py +223 -0
- package/.claude/scripts/tests/test_check_conformance_harness_mapping.py +243 -0
- package/.claude/scripts/tests/test_check_contamination.py +161 -0
- package/.claude/scripts/tests/test_check_creative_rewrite.py +183 -0
- package/.claude/scripts/tests/test_check_debate_round_lifecycle.py +162 -0
- package/.claude/scripts/tests/test_check_debt_ledger.py +227 -0
- package/.claude/scripts/tests/test_check_doc_skill_paths.py +99 -0
- package/.claude/scripts/tests/test_check_docs_freshness.py +224 -0
- package/.claude/scripts/tests/test_check_flip_criteria_drift.py +343 -0
- package/.claude/scripts/tests/test_check_flip_release_gate_consistency.py +195 -0
- package/.claude/scripts/tests/test_check_function_length.py +519 -0
- package/.claude/scripts/tests/test_check_model_deprecations.py +368 -0
- package/.claude/scripts/tests/test_check_originator_residue.py +165 -0
- package/.claude/scripts/tests/test_check_rule_invariants.py +327 -0
- package/.claude/scripts/tests/test_check_sdk_compat.py +88 -0
- package/.claude/scripts/tests/test_check_sidecar_manifest_sbom_sync.py +177 -0
- package/.claude/scripts/tests/test_check_spec_drift.py +358 -0
- package/.claude/scripts/tests/test_check_staleness.py +128 -0
- package/.claude/scripts/tests/test_check_stdlib_only_exceptions.py +91 -0
- package/.claude/scripts/tests/test_check_substrate_watch.py +234 -0
- package/.claude/scripts/tests/test_check_test_audit_isolation.py +322 -0
- package/.claude/scripts/tests/test_check_test_env_hygiene.py +432 -0
- package/.claude/scripts/tests/test_check_threat_model_coverage.py +251 -0
- package/.claude/scripts/tests/test_check_threat_model_freshness.py +235 -0
- package/.claude/scripts/tests/test_check_tier_boundaries.py +225 -0
- package/.claude/scripts/tests/test_check_tla_schema_drift.py +246 -0
- package/.claude/scripts/tests/test_check_translations_drift.py +262 -0
- package/.claude/scripts/tests/test_code_nav_bridge.py +192 -0
- package/.claude/scripts/tests/test_compaction_template.py +163 -0
- package/.claude/scripts/tests/test_compare_adopters.py +646 -0
- package/.claude/scripts/tests/test_confidence_gate.py +611 -0
- package/.claude/scripts/tests/test_confidence_gate_backfill.py +212 -0
- package/.claude/scripts/tests/test_context_budget.py +1400 -0
- package/.claude/scripts/tests/test_contextual_recommender.py +723 -0
- package/.claude/scripts/tests/test_coverage_audit_marker.py +109 -0
- package/.claude/scripts/tests/test_debate_converge.py +399 -0
- package/.claude/scripts/tests/test_debate_emit_cli.py +153 -0
- package/.claude/scripts/tests/test_debate_orchestrate.py +575 -0
- package/.claude/scripts/tests/test_detect_repo_profile.py +434 -0
- package/.claude/scripts/tests/test_discover_foreign_context.py +208 -0
- package/.claude/scripts/tests/test_dispatch_archetype_hint.py +429 -0
- package/.claude/scripts/tests/test_dispatch_frontmatter_validation.py +274 -0
- package/.claude/scripts/tests/test_drift_wire.py +259 -0
- package/.claude/scripts/tests/test_embeddings.py +249 -0
- package/.claude/scripts/tests/test_env_inventory_check.py +197 -0
- package/.claude/scripts/tests/test_eval_c3.py +474 -0
- package/.claude/scripts/tests/test_extract_skill.py +572 -0
- package/.claude/scripts/tests/test_fan_plan_parser.py +213 -0
- package/.claude/scripts/tests/test_find_orphan_sentinels.py +62 -0
- package/.claude/scripts/tests/test_first_run_wizard.py +634 -0
- package/.claude/scripts/tests/test_generate_adr_index.py +146 -0
- package/.claude/scripts/tests/test_generate_available_models.py +209 -0
- package/.claude/scripts/tests/test_generate_dispatch.py +90 -0
- package/.claude/scripts/tests/test_generate_skill_inventory.py +76 -0
- package/.claude/scripts/tests/test_github_api_client.py +146 -0
- package/.claude/scripts/tests/test_governance_waivers_gate.py +176 -0
- package/.claude/scripts/tests/test_hook_profiler.py +426 -0
- package/.claude/scripts/tests/test_import_skill.py +927 -0
- package/.claude/scripts/tests/test_import_skill_skip_rubric_auth.py +198 -0
- package/.claude/scripts/tests/test_inject_agent_context_mitigated_dispatch.py +266 -0
- package/.claude/scripts/tests/test_inject_agent_context_reference_mode.py +105 -0
- package/.claude/scripts/tests/test_inspired_by_validator.py +307 -0
- package/.claude/scripts/tests/test_install_dispatcher_present_maintainer.py +76 -0
- package/.claude/scripts/tests/test_install_maintainer_unchanged.py +86 -0
- package/.claude/scripts/tests/test_install_npm_sha256.py +113 -0
- package/.claude/scripts/tests/test_install_sh_placeholders.py +268 -0
- package/.claude/scripts/tests/test_install_sh_self_sha.py +244 -0
- package/.claude/scripts/tests/test_install_sh_session_75_flags.py +147 -0
- package/.claude/scripts/tests/test_install_user_dispatcher_present.py +75 -0
- package/.claude/scripts/tests/test_install_user_no_writes_outside_claude.py +75 -0
- package/.claude/scripts/tests/test_install_user_passes_validate_governance.py +73 -0
- package/.claude/scripts/tests/test_install_user_preserves_existing_repo.py +135 -0
- package/.claude/scripts/tests/test_install_user_skips_governance_hooks.py +102 -0
- package/.claude/scripts/tests/test_k_calibration.py +415 -0
- package/.claude/scripts/tests/test_key_hygiene.py +372 -0
- package/.claude/scripts/tests/test_lesson_ranker.py +82 -0
- package/.claude/scripts/tests/test_lesson_restore.py +91 -0
- package/.claude/scripts/tests/test_lessons.py +278 -0
- package/.claude/scripts/tests/test_lessons_concurrency.py +118 -0
- package/.claude/scripts/tests/test_lessons_emit.py +114 -0
- package/.claude/scripts/tests/test_lessons_inject.py +144 -0
- package/.claude/scripts/tests/test_lessons_v2.py +264 -0
- package/.claude/scripts/tests/test_lint_skills.py +525 -0
- package/.claude/scripts/tests/test_log_friction.py +436 -0
- package/.claude/scripts/tests/test_memory_prioritize.py +315 -0
- package/.claude/scripts/tests/test_morning_ledger.py +415 -0
- package/.claude/scripts/tests/test_mutation_test.py +144 -0
- package/.claude/scripts/tests/test_npm_rebuild.py +154 -0
- package/.claude/scripts/tests/test_osv_check.py +411 -0
- package/.claude/scripts/tests/test_otel_export.py +613 -0
- package/.claude/scripts/tests/test_otel_local_sink.py +262 -0
- package/.claude/scripts/tests/test_owasp_llm_top_10_benchmark.py +235 -0
- package/.claude/scripts/tests/test_parse_coverage_tier1.py +107 -0
- package/.claude/scripts/tests/test_pitfall_query.py +148 -0
- package/.claude/scripts/tests/test_plan_frontmatter_status.py +217 -0
- package/.claude/scripts/tests/test_plan_id_uniqueness.py +133 -0
- package/.claude/scripts/tests/test_plan_schema_enforcement.py +251 -0
- package/.claude/scripts/tests/test_plan_tokens.py +513 -0
- package/.claude/scripts/tests/test_plan_vcheck_gate.py +257 -0
- package/.claude/scripts/tests/test_policy_shadow_runner.py +312 -0
- package/.claude/scripts/tests/test_prune_lessons.py +341 -0
- package/.claude/scripts/tests/test_quality_profile.py +392 -0
- package/.claude/scripts/tests/test_rate_card_calibrate.py +185 -0
- package/.claude/scripts/tests/test_reality_ledger.py +1723 -0
- package/.claude/scripts/tests/test_red_team_eval.py +566 -0
- package/.claude/scripts/tests/test_red_team_eval_sha.py +260 -0
- package/.claude/scripts/tests/test_registry.py +290 -0
- package/.claude/scripts/tests/test_run_benchmark.py +639 -0
- package/.claude/scripts/tests/test_run_skill_benchmark_emit.py +195 -0
- package/.claude/scripts/tests/test_run_skill_benchmark_judge_mode.py +306 -0
- package/.claude/scripts/tests/test_scan_injection.py +191 -0
- package/.claude/scripts/tests/test_scan_injection_strict.sh +201 -0
- package/.claude/scripts/tests/test_scratchpad_cli.py +317 -0
- package/.claude/scripts/tests/test_self_test.py +369 -0
- package/.claude/scripts/tests/test_session_graph.py +511 -0
- package/.claude/scripts/tests/test_session_resume.py +306 -0
- package/.claude/scripts/tests/test_siem_rule_fixtures_have_paired_positive_negative.py +112 -0
- package/.claude/scripts/tests/test_skill_budget_generator.py +329 -0
- package/.claude/scripts/tests/test_skill_grandfather_parser.py +314 -0
- package/.claude/scripts/tests/test_skill_import_rubric.py +497 -0
- package/.claude/scripts/tests/test_skill_patch_apply_create_new_skill.py +459 -0
- package/.claude/scripts/tests/test_skill_patch_propose.py +294 -0
- package/.claude/scripts/tests/test_skill_patch_shadow_race.py +271 -0
- package/.claude/scripts/tests/test_skill_retrieval.py +486 -0
- package/.claude/scripts/tests/test_skill_retrieve_rag_wire.py +747 -0
- package/.claude/scripts/tests/test_smart_loading_resolver.py +808 -0
- package/.claude/scripts/tests/test_squad_export.py +265 -0
- package/.claude/scripts/tests/test_squad_grandfather_cap.py +434 -0
- package/.claude/scripts/tests/test_squad_import.py +905 -0
- package/.claude/scripts/tests/test_statusline_ceo.py +543 -0
- package/.claude/scripts/tests/test_success_receipt.py +448 -0
- package/.claude/scripts/tests/test_task_route.py +456 -0
- package/.claude/scripts/tests/test_token_budget_guard.py +418 -0
- package/.claude/scripts/tests/test_token_estimator.py +395 -0
- package/.claude/scripts/tests/test_trading_readonly.py +705 -0
- package/.claude/scripts/tests/test_ui_ux_imports.py +223 -0
- package/.claude/scripts/tests/test_validate_skill_frontmatter_pii_core.py +630 -0
- package/.claude/scripts/tests/test_validate_spec_context.py +128 -0
- package/.claude/scripts/tests/test_validate_squad_contract.py +221 -0
- package/.claude/scripts/tests/test_value_dashboard.py +593 -0
- package/.claude/scripts/tests/test_verify_adr_118_rationale.py +183 -0
- package/.claude/scripts/tests/test_verify_atlas_binding.py +159 -0
- package/.claude/scripts/tests/test_verify_counts.py +138 -0
- package/.claude/scripts/tests/test_verify_counts_remediation.py +258 -0
- package/.claude/scripts/tests/test_verify_persona_coverage.py +576 -0
- package/.claude/scripts/tests/test_veto_check.py +171 -0
- package/.claude/scripts/tests/test_workflow_devops_p2.py +229 -0
- package/.claude/scripts/tier_policy_cli/__init__.py +43 -0
- package/.claude/scripts/tier_policy_cli/_agent_frontmatter.py +196 -0
- package/.claude/scripts/tier_policy_cli/_constants.py +92 -0
- package/.claude/scripts/tier_policy_cli/_types.py +228 -0
- package/.claude/scripts/tier_policy_cli/apply.py +1139 -0
- package/.claude/scripts/tier_policy_cli/cli.py +795 -0
- package/.claude/scripts/tier_policy_cli/learn.py +846 -0
- package/.claude/scripts/tier_policy_cli/loader.py +535 -0
- package/.claude/scripts/tier_policy_cli/setup.py +33 -0
- package/.claude/scripts/tier_policy_cli/tests/__init__.py +0 -0
- package/.claude/scripts/tier_policy_cli/tests/test_adversarial.py +605 -0
- package/.claude/scripts/tier_policy_cli/tests/test_agent_frontmatter.py +231 -0
- package/.claude/scripts/tier_policy_cli/tests/test_apply.py +698 -0
- package/.claude/scripts/tier_policy_cli/tests/test_check_tier_policy_hook.py +187 -0
- package/.claude/scripts/tier_policy_cli/tests/test_cli.py +434 -0
- package/.claude/scripts/tier_policy_cli/tests/test_constants.py +113 -0
- package/.claude/scripts/tier_policy_cli/tests/test_learn.py +1380 -0
- package/.claude/scripts/tier_policy_cli/tests/test_learn_mutation.py +549 -0
- package/.claude/scripts/tier_policy_cli/tests/test_loader.py +368 -0
- package/.claude/scripts/tier_policy_cli/tests/test_types.py +152 -0
- package/.claude/scripts/token-budget-guard.py +657 -0
- package/.claude/scripts/token-estimator.py +957 -0
- package/.claude/scripts/tournament/__init__.py +22 -0
- package/.claude/scripts/tournament/check_fixture.py +271 -0
- package/.claude/scripts/tournament/fixtures/CORPUS_SHA256.txt +10 -0
- package/.claude/scripts/tournament/fixtures/code-review.jsonl +10 -0
- package/.claude/scripts/tournament/fixtures/docs-writing.jsonl +10 -0
- package/.claude/scripts/tournament/fixtures/performance-triage.jsonl +10 -0
- package/.claude/scripts/tournament/fixtures/security-review.jsonl +10 -0
- package/.claude/scripts/tournament/fixtures/test-design.jsonl +10 -0
- package/.claude/scripts/tournament/judge.py +269 -0
- package/.claude/scripts/tournament/loader.py +262 -0
- package/.claude/scripts/tournament/regen_corpus_sha.py +93 -0
- package/.claude/scripts/tournament/reporter.py +328 -0
- package/.claude/scripts/tournament/runner.py +707 -0
- package/.claude/scripts/tournament/scorer.py +118 -0
- package/.claude/scripts/tournament/tests/__init__.py +0 -0
- package/.claude/scripts/tournament/tests/_fake_dispatcher.py +233 -0
- package/.claude/scripts/tournament/tests/golden/strict_report_seed42.jsonl +6 -0
- package/.claude/scripts/tournament/tests/test_fixture_envelope.py +106 -0
- package/.claude/scripts/tournament/tests/test_fixture_security.py +227 -0
- package/.claude/scripts/tournament/tests/test_judge.py +299 -0
- package/.claude/scripts/tournament/tests/test_loader.py +223 -0
- package/.claude/scripts/tournament/tests/test_model_id_parity.py +136 -0
- package/.claude/scripts/tournament/tests/test_reporter.py +450 -0
- package/.claude/scripts/tournament/tests/test_reporter_golden.py +182 -0
- package/.claude/scripts/tournament/tests/test_runner.py +313 -0
- package/.claude/scripts/tournament/tests/test_runner_fail_open.py +204 -0
- package/.claude/scripts/tournament/tests/test_scorer.py +138 -0
- package/.claude/scripts/tournament/tests/test_tournament_e2e_smoke.py +147 -0
- package/.claude/scripts/tournament/tests/test_tournament_properties.py +181 -0
- package/.claude/scripts/trading-readonly-escape-hatch.sh +244 -0
- package/.claude/scripts/trading-readonly-guardrails.py +1136 -0
- package/.claude/scripts/translations-pairs.yaml +60 -0
- package/.claude/scripts/validate-findings.py +243 -0
- package/.claude/scripts/validate-governance.sh +1238 -0
- package/.claude/scripts/validate-skill-frontmatter.py +679 -0
- package/.claude/scripts/validate-spec-context.py +146 -0
- package/.claude/scripts/validate-squad-contract.py +318 -0
- package/.claude/scripts/validate_governance_fast.py +555 -0
- package/.claude/scripts/value-dashboard.py +851 -0
- package/.claude/scripts/verify-adr-118-rationale.py +285 -0
- package/.claude/scripts/verify-atlas-binding.py +331 -0
- package/.claude/scripts/verify-persona-coverage.py +531 -0
- package/.claude/scripts/verify-sprint3-invariants.sh +133 -0
- package/.claude/scripts/veto-check.py +218 -0
- package/.claude/security/README.md +200 -0
- package/.claude/security/sentinel-signers-registry.yaml +60 -0
- package/.claude/sentinel-signers.txt +24 -0
- package/.claude/settings.json +786 -0
- package/.claude/sidecars/c1-crypto/cryptography-mvp/README.md +89 -0
- package/.claude/sidecars/c1-crypto/cryptography-mvp/boundary_test.py +114 -0
- package/.claude/sidecars/c1-crypto/cryptography-mvp/install.sh +45 -0
- package/.claude/sidecars/c1-crypto/cryptography-mvp/manifest.json +52 -0
- package/.claude/sidecars/c1-crypto/cryptography-mvp/sidecar_code/cert_inspector.py +775 -0
- package/.claude/sidecars/c1-crypto/stdlib-ssl-mvp/boundary_test.py +318 -0
- package/.claude/sidecars/c1-crypto/stdlib-ssl-mvp/install.sh +57 -0
- package/.claude/sidecars/c1-crypto/stdlib-ssl-mvp/manifest.json +48 -0
- package/.claude/sidecars/c2-vector-memory/lightrag-mvp/README.md +88 -0
- package/.claude/sidecars/c2-vector-memory/lightrag-mvp/boundary_test.py +221 -0
- package/.claude/sidecars/c2-vector-memory/lightrag-mvp/install.sh +33 -0
- package/.claude/sidecars/c2-vector-memory/lightrag-mvp/manifest.json +59 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/boundary_test.py +142 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/install.sh +46 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/manifest.json +52 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/tests/__init__.py +0 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/tests/test_audit_emit_known_actions_property.py +123 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/tests/test_canonical_guard_symmetry_property.py +67 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/tests/test_payload_roundtrip_property.py +73 -0
- package/.claude/sidecars/c5-dev-tools/hypothesis/tests/test_redact_idempotence_property.py +68 -0
- package/.claude/skill-governance-grandfather.yaml +39 -0
- package/.claude/skill-patch-signers.txt +19 -0
- package/.claude/skills/core/agent-architect/SKILL.md +126 -0
- package/.claude/skills/core/ai-llm-orchestration/SKILL.md +620 -0
- package/.claude/skills/core/ai-llm-orchestration/SKILL.md.shadow.md +121 -0
- package/.claude/skills/core/architecture-decisions/SKILL.md +364 -0
- package/.claude/skills/core/architecture-decisions/benchmarks/architecture-decisions.yaml +257 -0
- package/.claude/skills/core/ceo-orchestration/SKILL-frontend.md +117 -0
- package/.claude/skills/core/ceo-orchestration/SKILL.md +700 -0
- package/.claude/skills/core/chaos-and-resilience/SKILL.md +568 -0
- package/.claude/skills/core/chaos-and-resilience/SKILL.md.shadow.md +553 -0
- package/.claude/skills/core/code-intelligence-lsp/SKILL.md +375 -0
- package/.claude/skills/core/code-review-checklist/SKILL.md +675 -0
- package/.claude/skills/core/code-review-checklist/SKILL.md.shadow.md +337 -0
- package/.claude/skills/core/code-review-checklist/benchmarks/code-review-checklist.yaml +444 -0
- package/.claude/skills/core/codebase-onboarding/SKILL.md +515 -0
- package/.claude/skills/core/compliance-lgpd/SKILL-frontend.md +513 -0
- package/.claude/skills/core/compliance-lgpd/SKILL.md +817 -0
- package/.claude/skills/core/consent-lifecycle/SKILL.md +149 -0
- package/.claude/skills/core/cookbook-advisor/SKILL.md +191 -0
- package/.claude/skills/core/coverage-audit/SKILL.md +116 -0
- package/.claude/skills/core/cross-llm-pair-review/SKILL.md +212 -0
- package/.claude/skills/core/data-schema-design/SKILL.md +933 -0
- package/.claude/skills/core/devops-ci-cd/SKILL.md +659 -0
- package/.claude/skills/core/dpo-reporting/SKILL.md +187 -0
- package/.claude/skills/core/evidence-based-qa/SKILL.md +565 -0
- package/.claude/skills/core/git-workflow-discipline/SKILL.md +600 -0
- package/.claude/skills/core/growth-and-launch/SKILL-frontend.md +800 -0
- package/.claude/skills/core/growth-and-launch/SKILL.md +903 -0
- package/.claude/skills/core/help-me/SKILL.md +177 -0
- package/.claude/skills/core/help-me/tests/test_help_me_skill.py +490 -0
- package/.claude/skills/core/identity-and-trust-architecture/SKILL.md +1062 -0
- package/.claude/skills/core/incident-management/SKILL.md +421 -0
- package/.claude/skills/core/incremental-refactoring/SKILL-frontend.md +210 -0
- package/.claude/skills/core/incremental-refactoring/SKILL.md +226 -0
- package/.claude/skills/core/llm-routing-and-finops/SKILL.md +828 -0
- package/.claude/skills/core/mcp-server-authoring/SKILL.md +685 -0
- package/.claude/skills/core/minimal-change-discipline/SKILL.md +545 -0
- package/.claude/skills/core/monetization-and-billing/SKILL-frontend.md +562 -0
- package/.claude/skills/core/monetization-and-billing/SKILL.md +585 -0
- package/.claude/skills/core/observability-and-ops/SKILL-frontend.md +290 -0
- package/.claude/skills/core/observability-and-ops/SKILL.md +612 -0
- package/.claude/skills/core/observability-and-ops/SKILL.md.shadow.md +324 -0
- package/.claude/skills/core/parallelization-by-default/SKILL.md +176 -0
- package/.claude/skills/core/parallelization-by-default/tests/test_parallelization_skill.py +490 -0
- package/.claude/skills/core/performance-engineering/SKILL.md +219 -0
- package/.claude/skills/core/performance-engineering/SKILL.md.shadow.md +204 -0
- package/.claude/skills/core/pii-data-flow/SKILL.md +166 -0
- package/.claude/skills/core/pre-plan-brainstorm/CHECKLIST.md +87 -0
- package/.claude/skills/core/pre-plan-brainstorm/SKILL.md +186 -0
- package/.claude/skills/core/product-conversion-readiness/SKILL-frontend.md +668 -0
- package/.claude/skills/core/product-conversion-readiness/SKILL.md +941 -0
- package/.claude/skills/core/public-api-design/SKILL.md +603 -0
- package/.claude/skills/core/public-api-design/benchmarks/public-api-design.yaml +261 -0
- package/.claude/skills/core/receiving-review/SKILL.md +131 -0
- package/.claude/skills/core/receiving-review/benchmarks/receiving-review.yaml +254 -0
- package/.claude/skills/core/requirement-quality-checklist/SKILL.md +97 -0
- package/.claude/skills/core/security-and-auth/SKILL.md +868 -0
- package/.claude/skills/core/security-and-auth/SKILL.md.shadow.md +500 -0
- package/.claude/skills/core/security-and-auth/benchmarks/owasp-basics.yaml +491 -0
- package/.claude/skills/core/security-and-auth/benchmarks/owasp-llm-top-10.yaml +769 -0
- package/.claude/skills/core/spec-clarify/SKILL.md +120 -0
- package/.claude/skills/core/state-machines-and-invariants/SKILL.md +288 -0
- package/.claude/skills/core/technical-writing/SKILL.md +432 -0
- package/.claude/skills/core/terse-mode/SKILL.md +80 -0
- package/.claude/skills/core/terse-mode/SKILL.md.shadow.md +65 -0
- package/.claude/skills/core/testing-strategy/SKILL.md +1026 -0
- package/.claude/skills/core/testing-strategy/SKILL.md.shadow.md +983 -0
- package/.claude/skills/domains/academic-humanities/examples/PLAN-EXAMPLE-ACH.md +126 -0
- package/.claude/skills/domains/academic-humanities/pitfalls.yaml +68 -0
- package/.claude/skills/domains/academic-humanities/skills/anthropologist/SKILL.md +394 -0
- package/.claude/skills/domains/academic-humanities/skills/geographer/SKILL.md +453 -0
- package/.claude/skills/domains/academic-humanities/skills/historian/SKILL.md +255 -0
- package/.claude/skills/domains/academic-humanities/skills/narratologist/SKILL.md +398 -0
- package/.claude/skills/domains/academic-humanities/skills/psychologist/SKILL.md +271 -0
- package/.claude/skills/domains/academic-humanities/task-chains.yaml +125 -0
- package/.claude/skills/domains/academic-humanities/team-personas.md +278 -0
- package/.claude/skills/domains/business-support/examples/PLAN-EXAMPLE-BSP.md +115 -0
- package/.claude/skills/domains/business-support/pitfalls.yaml +69 -0
- package/.claude/skills/domains/business-support/skills/analytics-reporter/SKILL.md +339 -0
- package/.claude/skills/domains/business-support/skills/executive-summary/SKILL.md +268 -0
- package/.claude/skills/domains/business-support/skills/finance-tracker/SKILL.md +321 -0
- package/.claude/skills/domains/business-support/skills/support-responder/SKILL.md +341 -0
- package/.claude/skills/domains/business-support/task-chains.yaml +118 -0
- package/.claude/skills/domains/business-support/team-personas.md +259 -0
- package/.claude/skills/domains/civil-engineering/skills/civil-engineer/SKILL.md +275 -0
- package/.claude/skills/domains/community/NOTICE.md +83 -0
- package/.claude/skills/domains/community/skills/advanced-evaluation/SKILL.md +463 -0
- package/.claude/skills/domains/community/skills/agent-evaluation/SKILL.md +400 -0
- package/.claude/skills/domains/community/skills/agentic-actions-auditor/SKILL.md +410 -0
- package/.claude/skills/domains/community/team-personas.md +41 -0
- package/.claude/skills/domains/devrel/examples/api-deprecation-comms.md +180 -0
- package/.claude/skills/domains/devrel/pitfalls.yaml +74 -0
- package/.claude/skills/domains/devrel/skills/developer-advocate/SKILL.md +382 -0
- package/.claude/skills/domains/devrel/task-chains.yaml +129 -0
- package/.claude/skills/domains/devrel/team-personas.md +260 -0
- package/.claude/skills/domains/edtech/examples/PLAN-EXAMPLE.md +89 -0
- package/.claude/skills/domains/edtech/pitfalls.yaml +98 -0
- package/.claude/skills/domains/edtech/skills/assessment-integrity/SKILL.md +208 -0
- package/.claude/skills/domains/edtech/skills/learning-analytics/SKILL.md +212 -0
- package/.claude/skills/domains/edtech/skills/student-data-privacy/SKILL.md +197 -0
- package/.claude/skills/domains/edtech/skills/study-abroad-advisory/SKILL.md +582 -0
- package/.claude/skills/domains/edtech/task-chains.yaml +122 -0
- package/.claude/skills/domains/edtech/team-personas.md +252 -0
- package/.claude/skills/domains/embedded/skills/embedded-firmware/SKILL.md +471 -0
- package/.claude/skills/domains/finance-accounting/examples/new-subscription-revenue.md +135 -0
- package/.claude/skills/domains/finance-accounting/pitfalls.yaml +74 -0
- package/.claude/skills/domains/finance-accounting/skills/bookkeeper-controller/SKILL.md +427 -0
- package/.claude/skills/domains/finance-accounting/skills/financial-analyst/SKILL.md +348 -0
- package/.claude/skills/domains/finance-accounting/skills/fpa-analyst/SKILL.md +366 -0
- package/.claude/skills/domains/finance-accounting/skills/tax-strategist/SKILL.md +358 -0
- package/.claude/skills/domains/finance-accounting/task-chains.yaml +90 -0
- package/.claude/skills/domains/finance-accounting/team-personas.md +281 -0
- package/.claude/skills/domains/fintech/ORG_CHART.md +167 -0
- package/.claude/skills/domains/fintech/commands/audit-ai.md +124 -0
- package/.claude/skills/domains/fintech/commands/deploy.md +15 -0
- package/.claude/skills/domains/fintech/commands/status.md +13 -0
- package/.claude/skills/domains/fintech/frontend-team-personas.md +503 -0
- package/.claude/skills/domains/fintech/pitfalls.yaml +58 -0
- package/.claude/skills/domains/fintech/scripts/check-pitfall-regression.sh +80 -0
- package/.claude/skills/domains/fintech/scripts/check-type-sync.sh +110 -0
- package/.claude/skills/domains/fintech/skills/blockchain-security-audit/SKILL.md +492 -0
- package/.claude/skills/domains/fintech/skills/equity-research/SKILL.md +459 -0
- package/.claude/skills/domains/fintech/skills/exchange-api-integration/SKILL.md +315 -0
- package/.claude/skills/domains/fintech/skills/exchange-onboarding-playbook/SKILL.md +527 -0
- package/.claude/skills/domains/fintech/skills/financial-correctness-and-math/SKILL-frontend.md +308 -0
- package/.claude/skills/domains/fintech/skills/financial-correctness-and-math/SKILL.md +340 -0
- package/.claude/skills/domains/fintech/skills/financial-display/SKILL.md +193 -0
- package/.claude/skills/domains/fintech/skills/frontend-data-layer/SKILL.md +206 -0
- package/.claude/skills/domains/fintech/skills/frontend-patterns/SKILL.md +387 -0
- package/.claude/skills/domains/fintech/skills/prediction-markets/SKILL.md +139 -0
- package/.claude/skills/domains/fintech/skills/real-time-market-systems/SKILL.md +315 -0
- package/.claude/skills/domains/fintech/skills/solidity-smart-contracts/SKILL.md +356 -0
- package/.claude/skills/domains/fintech/skills/trading-execution/SKILL.md +126 -0
- package/.claude/skills/domains/fintech/task-chains.yaml +46 -0
- package/.claude/skills/domains/fintech/team-personas.md +773 -0
- package/.claude/skills/domains/government/examples/PLAN-EXAMPLE.md +158 -0
- package/.claude/skills/domains/government/pitfalls.yaml +114 -0
- package/.claude/skills/domains/government/skills/accessibility-section-508/SKILL.md +183 -0
- package/.claude/skills/domains/government/skills/digital-presales/SKILL.md +359 -0
- package/.claude/skills/domains/government/skills/foia-and-records/SKILL.md +211 -0
- package/.claude/skills/domains/government/skills/public-procurement/SKILL.md +264 -0
- package/.claude/skills/domains/government/task-chains.yaml +88 -0
- package/.claude/skills/domains/government/team-personas.md +296 -0
- package/.claude/skills/domains/healthcare/examples/patient-portal-symptom-checker.md +130 -0
- package/.claude/skills/domains/healthcare/pitfalls.yaml +74 -0
- package/.claude/skills/domains/healthcare/skills/healthcare-customer-service/SKILL.md +369 -0
- package/.claude/skills/domains/healthcare/skills/marketing-compliance/SKILL.md +367 -0
- package/.claude/skills/domains/healthcare/task-chains.yaml +87 -0
- package/.claude/skills/domains/healthcare/team-personas.md +273 -0
- package/.claude/skills/domains/hospitality/skills/guest-services/SKILL.md +417 -0
- package/.claude/skills/domains/hr/examples/attrition-model-launch.md +128 -0
- package/.claude/skills/domains/hr/pitfalls.yaml +74 -0
- package/.claude/skills/domains/hr/skills/hr-onboarding/SKILL.md +435 -0
- package/.claude/skills/domains/hr/skills/recruitment-specialist/SKILL.md +400 -0
- package/.claude/skills/domains/hr/task-chains.yaml +91 -0
- package/.claude/skills/domains/hr/team-personas.md +251 -0
- package/.claude/skills/domains/i18n-business/examples/PLAN-EXAMPLE-I18N.md +115 -0
- package/.claude/skills/domains/i18n-business/pitfalls.yaml +68 -0
- package/.claude/skills/domains/i18n-business/skills/cultural-intelligence/SKILL.md +448 -0
- package/.claude/skills/domains/i18n-business/skills/french-consulting/SKILL.md +347 -0
- package/.claude/skills/domains/i18n-business/skills/korean-business/SKILL.md +360 -0
- package/.claude/skills/domains/i18n-business/skills/language-translator/SKILL.md +389 -0
- package/.claude/skills/domains/i18n-business/task-chains.yaml +117 -0
- package/.claude/skills/domains/i18n-business/team-personas.md +258 -0
- package/.claude/skills/domains/identity-systems/examples/passkey-rollout.md +137 -0
- package/.claude/skills/domains/identity-systems/pitfalls.yaml +74 -0
- package/.claude/skills/domains/identity-systems/skills/identity-graph-operator/SKILL.md +353 -0
- package/.claude/skills/domains/identity-systems/task-chains.yaml +90 -0
- package/.claude/skills/domains/identity-systems/team-personas.md +233 -0
- package/.claude/skills/domains/legal/examples/client-intake-pii-flow.md +177 -0
- package/.claude/skills/domains/legal/pitfalls.yaml +77 -0
- package/.claude/skills/domains/legal/skills/client-intake/SKILL.md +407 -0
- package/.claude/skills/domains/legal/skills/document-review/SKILL.md +373 -0
- package/.claude/skills/domains/legal/skills/legal-billing/SKILL.md +331 -0
- package/.claude/skills/domains/legal/task-chains.yaml +131 -0
- package/.claude/skills/domains/legal/team-personas.md +260 -0
- package/.claude/skills/domains/lgpd-heavy-saas/examples/PLAN-EXAMPLE.md +120 -0
- package/.claude/skills/domains/lgpd-heavy-saas/pitfalls.yaml +90 -0
- package/.claude/skills/domains/lgpd-heavy-saas/task-chains.yaml +83 -0
- package/.claude/skills/domains/lgpd-heavy-saas/team-personas.md +159 -0
- package/.claude/skills/domains/marketing-global/skills/agentic-search-optimizer/SKILL.md +391 -0
- package/.claude/skills/domains/marketing-global/skills/ai-citation-strategist/SKILL.md +343 -0
- package/.claude/skills/domains/marketing-global/skills/app-store-optimizer/SKILL.md +495 -0
- package/.claude/skills/domains/marketing-global/skills/book-co-author/SKILL.md +220 -0
- package/.claude/skills/domains/marketing-global/skills/carousel-growth-engine/SKILL.md +393 -0
- package/.claude/skills/domains/marketing-global/skills/content-creator/SKILL.md +416 -0
- package/.claude/skills/domains/marketing-global/skills/growth-hacker/SKILL.md +495 -0
- package/.claude/skills/domains/marketing-global/skills/instagram-curator/SKILL.md +419 -0
- package/.claude/skills/domains/marketing-global/skills/linkedin-content-creator/SKILL.md +291 -0
- package/.claude/skills/domains/marketing-global/skills/podcast-strategist/SKILL.md +408 -0
- package/.claude/skills/domains/marketing-global/skills/reddit-community-builder/SKILL.md +295 -0
- package/.claude/skills/domains/marketing-global/skills/seo-specialist/SKILL.md +352 -0
- package/.claude/skills/domains/marketing-global/skills/social-media-strategist/SKILL.md +349 -0
- package/.claude/skills/domains/marketing-global/skills/tiktok-strategist/SKILL.md +329 -0
- package/.claude/skills/domains/marketing-global/skills/twitter-engager/SKILL.md +382 -0
- package/.claude/skills/domains/marketing-global/skills/video-optimization-specialist/SKILL.md +386 -0
- package/.claude/skills/domains/mobile/examples/PLAN-EXAMPLE-MOB.md +129 -0
- package/.claude/skills/domains/mobile/pitfalls.yaml +69 -0
- package/.claude/skills/domains/mobile/skills/mobile-app-builder/SKILL.md +446 -0
- package/.claude/skills/domains/mobile/task-chains.yaml +126 -0
- package/.claude/skills/domains/mobile/team-personas.md +292 -0
- package/.claude/skills/domains/paid-media/examples/new-channel-launch.md +122 -0
- package/.claude/skills/domains/paid-media/pitfalls.yaml +79 -0
- package/.claude/skills/domains/paid-media/skills/auditor/SKILL.md +362 -0
- package/.claude/skills/domains/paid-media/skills/creative-strategist/SKILL.md +457 -0
- package/.claude/skills/domains/paid-media/skills/paid-social-strategist/SKILL.md +493 -0
- package/.claude/skills/domains/paid-media/skills/ppc-strategist/SKILL.md +450 -0
- package/.claude/skills/domains/paid-media/skills/programmatic-buyer/SKILL.md +396 -0
- package/.claude/skills/domains/paid-media/skills/search-query-analyst/SKILL.md +336 -0
- package/.claude/skills/domains/paid-media/skills/tracking-specialist/SKILL.md +457 -0
- package/.claude/skills/domains/paid-media/task-chains.yaml +121 -0
- package/.claude/skills/domains/paid-media/team-personas.md +251 -0
- package/.claude/skills/domains/project-management/examples/PLAN-EXAMPLE-PMG.md +117 -0
- package/.claude/skills/domains/project-management/pitfalls.yaml +68 -0
- package/.claude/skills/domains/project-management/skills/experiment-tracker/SKILL.md +293 -0
- package/.claude/skills/domains/project-management/skills/project-shepherd/SKILL.md +312 -0
- package/.claude/skills/domains/project-management/skills/studio-operations/SKILL.md +333 -0
- package/.claude/skills/domains/project-management/skills/studio-producer/SKILL.md +329 -0
- package/.claude/skills/domains/project-management/task-chains.yaml +118 -0
- package/.claude/skills/domains/project-management/team-personas.md +264 -0
- package/.claude/skills/domains/real-estate-finance/examples/PLAN-EXAMPLE-REF.md +129 -0
- package/.claude/skills/domains/real-estate-finance/pitfalls.yaml +68 -0
- package/.claude/skills/domains/real-estate-finance/skills/buyer-seller-agent/SKILL.md +410 -0
- package/.claude/skills/domains/real-estate-finance/skills/loan-officer-assistant/SKILL.md +415 -0
- package/.claude/skills/domains/real-estate-finance/task-chains.yaml +123 -0
- package/.claude/skills/domains/real-estate-finance/team-personas.md +287 -0
- package/.claude/skills/domains/retail/skills/customer-returns/SKILL.md +363 -0
- package/.claude/skills/domains/saas-platforms/examples/enterprise-tier-isolation.md +147 -0
- package/.claude/skills/domains/saas-platforms/pitfalls.yaml +74 -0
- package/.claude/skills/domains/saas-platforms/skills/cms-developer/SKILL.md +377 -0
- package/.claude/skills/domains/saas-platforms/skills/filament-specialist/SKILL.md +316 -0
- package/.claude/skills/domains/saas-platforms/skills/salesforce-architect/SKILL.md +369 -0
- package/.claude/skills/domains/saas-platforms/task-chains.yaml +90 -0
- package/.claude/skills/domains/saas-platforms/team-personas.md +283 -0
- package/.claude/skills/domains/sales/examples/qbr-revenue-forecast.md +158 -0
- package/.claude/skills/domains/sales/pitfalls.yaml +73 -0
- package/.claude/skills/domains/sales/skills/account-strategist/SKILL.md +408 -0
- package/.claude/skills/domains/sales/skills/deal-strategist/SKILL.md +292 -0
- package/.claude/skills/domains/sales/skills/discovery-coach/SKILL.md +257 -0
- package/.claude/skills/domains/sales/skills/outbound-strategist/SKILL.md +262 -0
- package/.claude/skills/domains/sales/skills/pipeline-analyst/SKILL.md +317 -0
- package/.claude/skills/domains/sales/skills/proposal-strategist/SKILL.md +288 -0
- package/.claude/skills/domains/sales/skills/sales-coach/SKILL.md +306 -0
- package/.claude/skills/domains/sales/skills/sales-engineer/SKILL.md +272 -0
- package/.claude/skills/domains/sales/skills/sales-outreach/SKILL.md +338 -0
- package/.claude/skills/domains/sales/task-chains.yaml +123 -0
- package/.claude/skills/domains/sales/team-personas.md +249 -0
- package/.claude/skills/domains/supply-chain/skills/supply-chain-strategist/SKILL.md +340 -0
- package/.claude/skills/domains/trading-hft/examples/PLAN-EXAMPLE.md +145 -0
- package/.claude/skills/domains/trading-hft/pitfalls.yaml +99 -0
- package/.claude/skills/domains/trading-hft/skills/kill-switches/SKILL.md +128 -0
- package/.claude/skills/domains/trading-hft/skills/latency-budgets/SKILL.md +117 -0
- package/.claude/skills/domains/trading-hft/skills/order-routing/SKILL.md +97 -0
- package/.claude/skills/domains/trading-hft/task-chains.yaml +97 -0
- package/.claude/skills/domains/trading-hft/team-personas.md +155 -0
- package/.claude/skills/domains/training-l-and-d/skills/corporate-training-designer/SKILL.md +268 -0
- package/.claude/skills/domains/voice-ai/skills/voice-ai-integration/SKILL.md +405 -0
- package/.claude/skills/frontend/NOTICE.md +80 -0
- package/.claude/skills/frontend/accessibility-and-wcag/SKILL.md +395 -0
- package/.claude/skills/frontend/accessibility-and-wcag/SKILL.md.shadow.md +181 -0
- package/.claude/skills/frontend/accessibility-and-wcag/benchmarks/accessibility-and-wcag.yaml +420 -0
- package/.claude/skills/frontend/accessibility-and-wcag/reference/charts-accessibility.yaml +357 -0
- package/.claude/skills/frontend/code-quality-and-typescript/SKILL.md +167 -0
- package/.claude/skills/frontend/design-system-and-components/SKILL.md +155 -0
- package/.claude/skills/frontend/design-system-and-components/SKILL.md.shadow.md +138 -0
- package/.claude/skills/frontend/design-system-and-components/reference/fonts.yaml +811 -0
- package/.claude/skills/frontend/design-system-and-components/reference/palettes.yaml +3066 -0
- package/.claude/skills/frontend/frontend-accessibility/SKILL.md +213 -0
- package/.claude/skills/frontend/frontend-data-layer/SKILL.md +310 -0
- package/.claude/skills/frontend/frontend-patterns/SKILL.md +771 -0
- package/.claude/skills/frontend/frontend-performance-optimization/SKILL.md +228 -0
- package/.claude/skills/frontend/frontend-performance-optimization/SKILL.md.shadow.md +213 -0
- package/.claude/skills/frontend/ux-and-user-journeys/SKILL.md +153 -0
- package/.claude/skills/frontend/ux-and-user-journeys/SKILL.md.shadow.md +138 -0
- package/.claude/skills/frontend/ux-and-user-journeys/reference/guidelines.yaml +997 -0
- package/.claude/squad-revocations.jsonl +5 -0
- package/.claude/task-chains.yaml +151 -0
- package/.claude/team.md +825 -0
- package/.claude/templates/squad-bundle/README.md +208 -0
- package/.claude/templates/squad-bundle/conftest.py +27 -0
- package/.claude/templates/squad-bundle/examples/template-example.md.template +94 -0
- package/.claude/templates/squad-bundle/pitfalls.yaml.template +88 -0
- package/.claude/templates/squad-bundle/task-chains.yaml.template +92 -0
- package/.claude/templates/squad-bundle/team-personas.md.template +161 -0
- package/.claude/trust/README.md +89 -0
- package/.claude/trust/owner.asc +11 -0
- package/.claude/workflows/README.md +124 -0
- package/.claude/workflows/audit-fanout.js +204 -0
- package/.claude/workflows/eval-baseline-n20.js +330 -0
- package/.claude/workflows/nightly-hygiene.js +176 -0
- package/LICENSE +21 -0
- package/PROTOCOL.md +597 -0
- package/README.md +167 -0
- package/SPEC/v1/README.md +181 -0
- package/SPEC/v1/adapters.schema.md +272 -0
- package/SPEC/v1/audit-log.schema.md +1514 -0
- package/SPEC/v1/audit-query.schema.md +152 -0
- package/SPEC/v1/benchmarks.schema.md +166 -0
- package/SPEC/v1/claude-sdk-compat.md +123 -0
- package/SPEC/v1/debate.schema.md +35 -0
- package/SPEC/v1/hook-io.schema.md +94 -0
- package/SPEC/v1/install-cli.md +234 -0
- package/SPEC/v1/judge-payload.schema.md +98 -0
- package/SPEC/v1/live-adapters-policy.schema.md +118 -0
- package/SPEC/v1/mcp-server.schema.md +558 -0
- package/SPEC/v1/memory-shared.schema.md +365 -0
- package/SPEC/v1/normalized_envelope.schema.md +183 -0
- package/SPEC/v1/npm-shim.md +95 -0
- package/SPEC/v1/plan.schema.md +34 -0
- package/SPEC/v1/policy-dsl.schema.md +466 -0
- package/SPEC/v1/predict-budget.schema.md +289 -0
- package/SPEC/v1/rag-sidecar.schema.md +222 -0
- package/SPEC/v1/red-team-corpus.schema.md +186 -0
- package/SPEC/v1/replay.schema.md +272 -0
- package/SPEC/v1/scratchpad.schema.md +172 -0
- package/SPEC/v1/sentinel-format.schema.md +306 -0
- package/SPEC/v1/session-graph.schema.md +236 -0
- package/SPEC/v1/skill-frontmatter.schema.md +83 -0
- package/SPEC/v1/skill-index.schema.md +197 -0
- package/SPEC/v1/skill-proposals.schema.md +175 -0
- package/SPEC/v1/soc2-control-map.schema.md +797 -0
- package/SPEC/v1/squad-manifest.schema.md +157 -0
- package/SPEC/v1/state-stores.schema.md +146 -0
- package/SPEC/v1/tier-policy.schema.md +264 -0
- package/SPEC/v1/tournament-report.schema.md +156 -0
- package/VERSION +1 -0
- package/bin/ceo-orch-init.js +55 -0
- package/package.json +42 -0
- package/scripts/_framework_manifest_set.sh +237 -0
- package/scripts/_hash_lib.sh +92 -0
- package/scripts/build-plugin.py +351 -0
- package/scripts/discover_foreign_context.py +151 -0
- package/scripts/install-accelerators.sh +166 -0
- package/scripts/install-npm.sh +254 -0
- package/scripts/install.sh +1932 -0
- package/scripts/local/OWNER-CEREMONY-PLAN-094-WAVE-A.sh +648 -0
- package/scripts/local/OWNER-CEREMONY-S82-V1120.sh +169 -0
- package/scripts/local/plan-093-apply-kernel-edits.py +496 -0
- package/scripts/local/plan-093-execute-ceremony.sh +118 -0
- package/scripts/local/plan-093-kernel-override-restart.sh +115 -0
- package/scripts/local/plan-093-ship-v1.26.0.sh +226 -0
- package/scripts/local/plan-094-apply-wave-a-c-e.py +398 -0
- package/scripts/local/smoke-install-parity.sh +168 -0
- package/scripts/local/trading-readonly-escape-hatch.sh +244 -0
- package/scripts/measure-repo-size.sh +98 -0
- package/scripts/npm-rebuild.sh +172 -0
- package/scripts/publish-plugin.sh +144 -0
- package/scripts/tests/smoke-install.sh +260 -0
- package/scripts/tests/test-install-sandbox-merge.sh +137 -0
- package/scripts/tests/test_install_baseline_manifest.sh +392 -0
- package/scripts/uninstall.sh +282 -0
- package/scripts/upgrade.sh +1260 -0
- package/templates/.claude/tier-policy.json +35 -0
- package/templates/.claude/tier-policy.json.sigchain +1 -0
- package/templates/.env.example +134 -0
- package/templates/.github/CODEOWNERS.template +33 -0
- package/templates/.github/workflows/benchmarks.yml.template +145 -0
- package/templates/.github/workflows/validate.yml.template +226 -0
- package/templates/.mcp.json +13 -0
- package/templates/CLAUDE.md +125 -0
- package/templates/MEMORY.md +36 -0
- package/templates/README.md +46 -0
- package/templates/compaction.md +130 -0
- package/templates/docs/BRANCH-PROTECTION.md +203 -0
- package/templates/docs/rotation-log.md +18 -0
- package/templates/oidc-proxy/README.md +141 -0
- package/templates/oidc-proxy/broker.config.example.json +29 -0
- package/templates/oidc-proxy/oidc_key_broker.py +361 -0
- package/templates/oidc-proxy/tests/test_oidc_key_broker.py +361 -0
- package/templates/scripts/statusline-ceo.py +597 -0
- package/templates/settings/settings.base.json +708 -0
- package/templates/settings/settings.stack.node.json +19 -0
- package/templates/settings/settings.stack.otel.json +25 -0
- package/templates/settings/settings.stack.sandbox.json +57 -0
- package/templates/settings/settings.user.json +265 -0
- package/templates/team-personas-reference.md +269 -0
|
@@ -0,0 +1,2679 @@
|
|
|
1
|
+
"""Comprehensive audit-emitter coverage gate (PLAN-019 P1-QA-4 closure).
|
|
2
|
+
|
|
3
|
+
This file discharges audit finding P1-QA-4 — "5 audit emitters without
|
|
4
|
+
direct test-level assertions". It also installs a drift-safe gate that
|
|
5
|
+
iterates `_lib.audit_emit._KNOWN_ACTIONS` at runtime and demands at least
|
|
6
|
+
one `test_emit_<action>_*` method per known action. When a future
|
|
7
|
+
engineer adds a new event type to `_KNOWN_ACTIONS` but forgets to add a
|
|
8
|
+
direct test, this file fails loudly at import time — long before a PII /
|
|
9
|
+
schema regression can slip into the audit log.
|
|
10
|
+
|
|
11
|
+
## What this file covers
|
|
12
|
+
|
|
13
|
+
1. **Per-emitter basic emission** — one `test_emit_<action>_basic` method
|
|
14
|
+
per `_KNOWN_ACTIONS` entry (except `agent_spawn`, which is emitted by
|
|
15
|
+
`audit_log.py` and has its own test in `test_audit_log.py`; we verify
|
|
16
|
+
`_write_event` accepts the action and emits a minimal row).
|
|
17
|
+
2. **Redaction invariant** — any emitter whose function signature accepts
|
|
18
|
+
a free-text field (`reason`, `reason_preview`, `snippet_preview`,
|
|
19
|
+
`detail`, `diff_summary`, etc.) gets a `*_redacts_secret` test that
|
|
20
|
+
injects a fake API key (`sk-ant-api03-fake-key-for-redaction-test`),
|
|
21
|
+
a GitHub PAT, or a `password=...` assignment and asserts the redacted
|
|
22
|
+
output never contains the original substring.
|
|
23
|
+
3. **Drift-safe enumeration** — `TestEmitterCoverageGate` reads
|
|
24
|
+
`_KNOWN_ACTIONS` at runtime and asserts every action has coverage.
|
|
25
|
+
4. **FileLock hygiene** — a concurrent 3-thread stress test emits
|
|
26
|
+
`state_store_write` events and asserts every JSONL line is
|
|
27
|
+
well-formed (no torn writes).
|
|
28
|
+
|
|
29
|
+
## Why these 5 were named
|
|
30
|
+
|
|
31
|
+
Per PLAN-018 audit finding P1-QA-4, the original 5 named gaps were:
|
|
32
|
+
|
|
33
|
+
- `emit_injection_flag` — has free-text `snippet_preview`
|
|
34
|
+
- `emit_state_store_write` — SHA-hashes inputs; needs explicit emit check
|
|
35
|
+
- `emit_state_store_read` — same
|
|
36
|
+
- `emit_state_store_pruned` — same
|
|
37
|
+
- `emit_lesson_outcome_undone` — admin escape hatch; zero tests before
|
|
38
|
+
|
|
39
|
+
This file closes those gaps AND adds the same coverage to every other
|
|
40
|
+
`_KNOWN_ACTIONS` entry, because the next gap will otherwise be invisible.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
from __future__ import annotations
|
|
44
|
+
|
|
45
|
+
import inspect
|
|
46
|
+
import json
|
|
47
|
+
import os
|
|
48
|
+
import sys
|
|
49
|
+
import threading
|
|
50
|
+
import unittest
|
|
51
|
+
from pathlib import Path
|
|
52
|
+
from typing import Any, Dict, List
|
|
53
|
+
|
|
54
|
+
import pytest
|
|
55
|
+
|
|
56
|
+
# Make _lib importable when pytest is run from the repo root
|
|
57
|
+
|
|
58
|
+
from _lib import audit_emit # noqa: E402
|
|
59
|
+
from _lib.testing import TestEnvContext # noqa: E402
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# -----------------------------------------------------------------------------
|
|
63
|
+
# Canonical redaction probes (exactly one place to change the fake values)
|
|
64
|
+
# -----------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
FAKE_API_KEY = "sk-ant-api03-fake-key-for-redaction-test-xyz"
|
|
67
|
+
FAKE_GITHUB_PAT = "ghp_" + "a" * 36
|
|
68
|
+
FAKE_PASSWORD_ASSIGN = "password=my-super-secret-value-123"
|
|
69
|
+
REDACTED_API_KEY_MARKER = "[API_KEY]"
|
|
70
|
+
REDACTED_PAT_MARKER = "[GITHUB_PAT]"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# -----------------------------------------------------------------------------
|
|
74
|
+
# Test helpers
|
|
75
|
+
# -----------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class _EmitterTestBase(TestEnvContext):
|
|
79
|
+
"""Base: every subclass gets a fresh audit dir + helper readers."""
|
|
80
|
+
|
|
81
|
+
def _read_events(self) -> List[Dict[str, Any]]:
|
|
82
|
+
"""Return every event in the isolated audit-log.jsonl."""
|
|
83
|
+
log = Path(os.environ["CEO_AUDIT_LOG_PATH"])
|
|
84
|
+
if not log.exists():
|
|
85
|
+
return []
|
|
86
|
+
out: List[Dict[str, Any]] = []
|
|
87
|
+
for line in log.read_text(encoding="utf-8").splitlines():
|
|
88
|
+
line = line.strip()
|
|
89
|
+
if not line:
|
|
90
|
+
continue
|
|
91
|
+
out.append(json.loads(line))
|
|
92
|
+
return out
|
|
93
|
+
|
|
94
|
+
def _read_one(self) -> Dict[str, Any]:
|
|
95
|
+
"""Return the single event (fails if count != 1)."""
|
|
96
|
+
events = self._read_events()
|
|
97
|
+
self.assertEqual(
|
|
98
|
+
len(events),
|
|
99
|
+
1,
|
|
100
|
+
f"expected exactly 1 event in log, got {len(events)}: {events!r}",
|
|
101
|
+
)
|
|
102
|
+
return events[0]
|
|
103
|
+
|
|
104
|
+
def _assert_schema_baseline(self, event: Dict[str, Any], action: str) -> None:
|
|
105
|
+
"""Assert every event includes the framework-wide reserved fields.
|
|
106
|
+
|
|
107
|
+
Per audit_emit._write_event, every event MUST include:
|
|
108
|
+
- action (discriminator)
|
|
109
|
+
- event_schema == "v2"
|
|
110
|
+
- ts (ISO 8601 UTC)
|
|
111
|
+
- tokens_in / tokens_out / tokens_total (nullable placeholders)
|
|
112
|
+
- session_id + project (empty string OK but key present)
|
|
113
|
+
"""
|
|
114
|
+
self.assertEqual(event["action"], action)
|
|
115
|
+
self.assertEqual(event["event_schema"], "v2")
|
|
116
|
+
self.assertIn("ts", event)
|
|
117
|
+
self.assertIsInstance(event["ts"], str)
|
|
118
|
+
# Token placeholders reserved
|
|
119
|
+
for k in ("tokens_in", "tokens_out", "tokens_total"):
|
|
120
|
+
self.assertIn(k, event, f"reserved token field missing: {k}")
|
|
121
|
+
# session_id / project present (empty string OK)
|
|
122
|
+
self.assertIn("session_id", event)
|
|
123
|
+
self.assertIn("project", event)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# -----------------------------------------------------------------------------
|
|
127
|
+
# Per-emitter tests (grouped by lineage to keep the file navigable)
|
|
128
|
+
# -----------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class TestCoreEmitters(_EmitterTestBase):
|
|
132
|
+
"""v1 + initial v2 emitters: agent_spawn / debate / plan / veto / benchmark."""
|
|
133
|
+
|
|
134
|
+
def test_emit_agent_spawn_basic(self):
|
|
135
|
+
# agent_spawn is emitted directly by audit_log.py (not a standalone
|
|
136
|
+
# function in audit_emit.py). We verify _write_event accepts the
|
|
137
|
+
# action and writes a valid row.
|
|
138
|
+
audit_emit._write_event({
|
|
139
|
+
"action": "agent_spawn",
|
|
140
|
+
"agent_name": "Test Agent",
|
|
141
|
+
"session_id": "s-agent-spawn",
|
|
142
|
+
"project": "/t",
|
|
143
|
+
})
|
|
144
|
+
e = self._read_one()
|
|
145
|
+
self._assert_schema_baseline(e, "agent_spawn")
|
|
146
|
+
self.assertEqual(e["agent_name"], "Test Agent")
|
|
147
|
+
|
|
148
|
+
def test_emit_debate_event_basic(self):
|
|
149
|
+
audit_emit.emit_debate_event(
|
|
150
|
+
plan_id="PLAN-001",
|
|
151
|
+
round_num=1,
|
|
152
|
+
phase="agent-done",
|
|
153
|
+
agent="vp-engineering",
|
|
154
|
+
artifact_path="round-1/vp.md",
|
|
155
|
+
session_id="s1",
|
|
156
|
+
project="/t",
|
|
157
|
+
)
|
|
158
|
+
e = self._read_one()
|
|
159
|
+
self._assert_schema_baseline(e, "debate_event")
|
|
160
|
+
self.assertEqual(e["plan_id"], "PLAN-001")
|
|
161
|
+
self.assertEqual(e["round"], 1)
|
|
162
|
+
self.assertEqual(e["phase"], "agent-done")
|
|
163
|
+
self.assertEqual(e["agent"], "vp-engineering")
|
|
164
|
+
|
|
165
|
+
def test_emit_plan_transition_basic(self):
|
|
166
|
+
audit_emit.emit_plan_transition(
|
|
167
|
+
plan_id="PLAN-002",
|
|
168
|
+
from_status="draft",
|
|
169
|
+
to_status="reviewed",
|
|
170
|
+
file_path=".claude/plans/PLAN-002-x.md",
|
|
171
|
+
session_id="s2",
|
|
172
|
+
project="/t",
|
|
173
|
+
)
|
|
174
|
+
e = self._read_one()
|
|
175
|
+
self._assert_schema_baseline(e, "plan_transition")
|
|
176
|
+
self.assertEqual(e["from_status"], "draft")
|
|
177
|
+
self.assertEqual(e["to_status"], "reviewed")
|
|
178
|
+
self.assertTrue(e["transition_legal"])
|
|
179
|
+
|
|
180
|
+
def test_emit_veto_triggered_basic(self):
|
|
181
|
+
audit_emit.emit_veto_triggered(
|
|
182
|
+
hook="check_agent_spawn",
|
|
183
|
+
reason_code="missing_skill_content",
|
|
184
|
+
reason_preview="simple human reason",
|
|
185
|
+
blocked_tool="Agent",
|
|
186
|
+
strike_count=1,
|
|
187
|
+
session_id="s3",
|
|
188
|
+
project="/t",
|
|
189
|
+
)
|
|
190
|
+
e = self._read_one()
|
|
191
|
+
self._assert_schema_baseline(e, "veto_triggered")
|
|
192
|
+
self.assertEqual(e["hook"], "check_agent_spawn")
|
|
193
|
+
self.assertEqual(e["reason_code"], "missing_skill_content")
|
|
194
|
+
self.assertEqual(e["blocked_tool"], "Agent")
|
|
195
|
+
self.assertEqual(e["strike_count"], 1)
|
|
196
|
+
|
|
197
|
+
def test_emit_veto_triggered_redacts_secret_in_reason(self):
|
|
198
|
+
audit_emit.emit_veto_triggered(
|
|
199
|
+
hook="check_agent_spawn",
|
|
200
|
+
reason_code="leak_attempt",
|
|
201
|
+
reason_preview=f"leaked key {FAKE_API_KEY} in prompt",
|
|
202
|
+
blocked_tool="Agent",
|
|
203
|
+
)
|
|
204
|
+
e = self._read_one()
|
|
205
|
+
self.assertNotIn(FAKE_API_KEY, e["reason_preview"])
|
|
206
|
+
self.assertIn(REDACTED_API_KEY_MARKER, e["reason_preview"])
|
|
207
|
+
|
|
208
|
+
def test_emit_benchmark_run_basic(self):
|
|
209
|
+
audit_emit.emit_benchmark_run(
|
|
210
|
+
benchmark_id="bench-001",
|
|
211
|
+
skill="owasp-basics",
|
|
212
|
+
pass_count=8,
|
|
213
|
+
fail_count=2,
|
|
214
|
+
pass_rate=0.8,
|
|
215
|
+
median_score=7.5,
|
|
216
|
+
floor=7.0,
|
|
217
|
+
cost_usd=0.42,
|
|
218
|
+
duration_s=120.5,
|
|
219
|
+
lessons_written=3,
|
|
220
|
+
session_id="s4",
|
|
221
|
+
project="/t",
|
|
222
|
+
)
|
|
223
|
+
e = self._read_one()
|
|
224
|
+
self._assert_schema_baseline(e, "benchmark_run")
|
|
225
|
+
self.assertEqual(e["benchmark_id"], "bench-001")
|
|
226
|
+
self.assertEqual(e["skill"], "owasp-basics")
|
|
227
|
+
self.assertEqual(e["pass_count"], 8)
|
|
228
|
+
# Float fields are now int-encoded (bps/cents/ms) per canonical_json invariant.
|
|
229
|
+
self.assertEqual(e["pass_rate_bps"], 800)
|
|
230
|
+
self.assertEqual(e["cost_usd_cents"], 42)
|
|
231
|
+
self.assertEqual(e["duration_ms"], 120500)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class TestInjectionFlag(_EmitterTestBase):
|
|
235
|
+
"""emit_injection_flag — named P1-QA-4 gap #1."""
|
|
236
|
+
|
|
237
|
+
def test_emit_injection_flag_basic(self):
|
|
238
|
+
audit_emit.emit_injection_flag(
|
|
239
|
+
source="/tmp/read.txt",
|
|
240
|
+
family_counts={"direct_override": 2, "tool_invoke": 1},
|
|
241
|
+
match_count=3,
|
|
242
|
+
bytes_scanned=4096,
|
|
243
|
+
triggered_by_tool="Read",
|
|
244
|
+
snippet_preview="please ignore previous instructions",
|
|
245
|
+
truncated=False,
|
|
246
|
+
session_id="sif",
|
|
247
|
+
project="/t",
|
|
248
|
+
)
|
|
249
|
+
e = self._read_one()
|
|
250
|
+
self._assert_schema_baseline(e, "injection_flag")
|
|
251
|
+
self.assertEqual(e["source"], "/tmp/read.txt")
|
|
252
|
+
self.assertEqual(e["family_counts"]["direct_override"], 2)
|
|
253
|
+
self.assertEqual(e["match_count"], 3)
|
|
254
|
+
self.assertEqual(e["bytes_scanned"], 4096)
|
|
255
|
+
self.assertFalse(e["truncated"])
|
|
256
|
+
self.assertEqual(e["triggered_by_tool"], "Read")
|
|
257
|
+
|
|
258
|
+
def test_emit_injection_flag_redacts_secret_in_preview(self):
|
|
259
|
+
audit_emit.emit_injection_flag(
|
|
260
|
+
source="<stdin>",
|
|
261
|
+
family_counts={"direct_override": 1},
|
|
262
|
+
match_count=1,
|
|
263
|
+
bytes_scanned=100,
|
|
264
|
+
triggered_by_tool="Read",
|
|
265
|
+
snippet_preview=f"exfil token {FAKE_API_KEY} in snippet",
|
|
266
|
+
)
|
|
267
|
+
e = self._read_one()
|
|
268
|
+
self.assertNotIn(FAKE_API_KEY, e["snippet_preview"])
|
|
269
|
+
self.assertIn(REDACTED_API_KEY_MARKER, e["snippet_preview"])
|
|
270
|
+
|
|
271
|
+
def test_emit_injection_flag_preview_truncated_at_200(self):
|
|
272
|
+
audit_emit.emit_injection_flag(
|
|
273
|
+
source="/tmp/big.txt",
|
|
274
|
+
family_counts={"noise": 1},
|
|
275
|
+
match_count=1,
|
|
276
|
+
bytes_scanned=1,
|
|
277
|
+
snippet_preview="x" * 400,
|
|
278
|
+
)
|
|
279
|
+
e = self._read_one()
|
|
280
|
+
# preview is capped at 200 per emit_injection_flag contract
|
|
281
|
+
self.assertLessEqual(len(e["snippet_preview"]), 200)
|
|
282
|
+
|
|
283
|
+
def test_emit_injection_flag_truncated_flag_propagates(self):
|
|
284
|
+
audit_emit.emit_injection_flag(
|
|
285
|
+
source="/tmp/capped.bin",
|
|
286
|
+
family_counts={},
|
|
287
|
+
match_count=0,
|
|
288
|
+
bytes_scanned=1048576,
|
|
289
|
+
truncated=True,
|
|
290
|
+
)
|
|
291
|
+
e = self._read_one()
|
|
292
|
+
self.assertTrue(e["truncated"])
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
class TestLessonEmitters(_EmitterTestBase):
|
|
296
|
+
"""lesson_write / read / archived / restored / outcome / outcome_undone."""
|
|
297
|
+
|
|
298
|
+
def test_emit_lesson_write_basic(self):
|
|
299
|
+
audit_emit.emit_lesson_write(
|
|
300
|
+
lesson_id="lsn-1",
|
|
301
|
+
archetype="security-engineer",
|
|
302
|
+
scope_tags=["security", "owasp"],
|
|
303
|
+
trigger="benchmark_fail",
|
|
304
|
+
source_event_id="evt-123",
|
|
305
|
+
session_id="slw",
|
|
306
|
+
project="/t",
|
|
307
|
+
)
|
|
308
|
+
e = self._read_one()
|
|
309
|
+
self._assert_schema_baseline(e, "lesson_write")
|
|
310
|
+
self.assertEqual(e["lesson_id"], "lsn-1")
|
|
311
|
+
self.assertEqual(e["archetype"], "security-engineer")
|
|
312
|
+
self.assertListEqual(e["scope_tags"], ["security", "owasp"])
|
|
313
|
+
self.assertEqual(e["trigger"], "benchmark_fail")
|
|
314
|
+
|
|
315
|
+
def test_emit_lesson_outcome_basic(self):
|
|
316
|
+
audit_emit.emit_lesson_outcome(
|
|
317
|
+
lesson_id="lsn-1",
|
|
318
|
+
archetype="security-engineer",
|
|
319
|
+
hit=True,
|
|
320
|
+
hit_count=5,
|
|
321
|
+
miss_count=2,
|
|
322
|
+
consumer="benchmark",
|
|
323
|
+
inference_mode="window-only",
|
|
324
|
+
window_duration_seconds=3600,
|
|
325
|
+
session_end_reason="",
|
|
326
|
+
session_id="slo",
|
|
327
|
+
project="/t",
|
|
328
|
+
)
|
|
329
|
+
e = self._read_one()
|
|
330
|
+
self._assert_schema_baseline(e, "lesson_outcome")
|
|
331
|
+
self.assertTrue(e["hit"])
|
|
332
|
+
self.assertEqual(e["hit_count"], 5)
|
|
333
|
+
self.assertEqual(e["consumer"], "benchmark")
|
|
334
|
+
self.assertEqual(e["inference_mode"], "window-only")
|
|
335
|
+
self.assertEqual(e["window_duration_seconds"], 3600)
|
|
336
|
+
|
|
337
|
+
def test_emit_lesson_read_basic(self):
|
|
338
|
+
audit_emit.emit_lesson_read(
|
|
339
|
+
lesson_ids=["l1", "l2", "l3"],
|
|
340
|
+
archetype="vp-engineering",
|
|
341
|
+
keywords=["arch", "sota"],
|
|
342
|
+
k=3,
|
|
343
|
+
consumer="architect",
|
|
344
|
+
session_id="slr",
|
|
345
|
+
project="/t",
|
|
346
|
+
)
|
|
347
|
+
e = self._read_one()
|
|
348
|
+
self._assert_schema_baseline(e, "lesson_read")
|
|
349
|
+
self.assertListEqual(e["lesson_ids"], ["l1", "l2", "l3"])
|
|
350
|
+
self.assertEqual(e["lesson_count"], 3)
|
|
351
|
+
self.assertEqual(e["k"], 3)
|
|
352
|
+
self.assertEqual(e["consumer"], "architect")
|
|
353
|
+
|
|
354
|
+
def test_emit_lesson_archived_basic(self):
|
|
355
|
+
audit_emit.emit_lesson_archived(
|
|
356
|
+
lesson_id="lsn-old",
|
|
357
|
+
archetype="qa-architect",
|
|
358
|
+
hit_count=1,
|
|
359
|
+
miss_count=20,
|
|
360
|
+
hit_rate=0.047,
|
|
361
|
+
archive_path=".claude/lessons/archive/lsn-old.md",
|
|
362
|
+
reason="low_hit_rate",
|
|
363
|
+
session_id="sla",
|
|
364
|
+
project="/t",
|
|
365
|
+
)
|
|
366
|
+
e = self._read_one()
|
|
367
|
+
self._assert_schema_baseline(e, "lesson_archived")
|
|
368
|
+
self.assertEqual(e["reason"], "low_hit_rate")
|
|
369
|
+
# hit_rate_bps: int basis-points (0.047 × 1000 = 47). No float field.
|
|
370
|
+
self.assertEqual(e["hit_rate_bps"], 47)
|
|
371
|
+
self.assertNotIn("hit_rate", e, "old float field must not appear in emit")
|
|
372
|
+
|
|
373
|
+
def test_emit_lesson_restored_basic(self):
|
|
374
|
+
audit_emit.emit_lesson_restored(
|
|
375
|
+
lesson_id="lsn-old",
|
|
376
|
+
archetype="qa-architect",
|
|
377
|
+
restored_from=".claude/lessons/archive/lsn-old.md",
|
|
378
|
+
restored_to=".claude/lessons/lsn-old.md",
|
|
379
|
+
session_id="slrs",
|
|
380
|
+
project="/t",
|
|
381
|
+
)
|
|
382
|
+
e = self._read_one()
|
|
383
|
+
self._assert_schema_baseline(e, "lesson_restored")
|
|
384
|
+
self.assertIn("archive", e["restored_from"])
|
|
385
|
+
|
|
386
|
+
def test_emit_lesson_outcome_undone_basic(self):
|
|
387
|
+
audit_emit.emit_lesson_outcome_undone(
|
|
388
|
+
lesson_id="lsn-1",
|
|
389
|
+
archetype="security-engineer",
|
|
390
|
+
consumer="architect",
|
|
391
|
+
undone_kind="hit",
|
|
392
|
+
hit_count=4,
|
|
393
|
+
miss_count=2,
|
|
394
|
+
session_id="slou",
|
|
395
|
+
project="/t",
|
|
396
|
+
)
|
|
397
|
+
e = self._read_one()
|
|
398
|
+
self._assert_schema_baseline(e, "lesson_outcome_undone")
|
|
399
|
+
self.assertEqual(e["undone_kind"], "hit")
|
|
400
|
+
self.assertEqual(e["hit_count"], 4)
|
|
401
|
+
self.assertEqual(e["miss_count"], 2)
|
|
402
|
+
self.assertEqual(e["consumer"], "architect")
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class TestConfidenceGate(_EmitterTestBase):
|
|
406
|
+
"""emit_confidence_gate — Sprint 8 Phase 2."""
|
|
407
|
+
|
|
408
|
+
def test_emit_confidence_gate_basic(self):
|
|
409
|
+
audit_emit.emit_confidence_gate(
|
|
410
|
+
claim_count=10,
|
|
411
|
+
pass_count=8,
|
|
412
|
+
fail_count=2,
|
|
413
|
+
verifier_kind_counts={"fact": 6, "code": 4},
|
|
414
|
+
agent_name="vp-engineering",
|
|
415
|
+
source="stdin",
|
|
416
|
+
session_id="scg",
|
|
417
|
+
project="/t",
|
|
418
|
+
)
|
|
419
|
+
e = self._read_one()
|
|
420
|
+
self._assert_schema_baseline(e, "confidence_gate")
|
|
421
|
+
self.assertEqual(e["claim_count"], 10)
|
|
422
|
+
self.assertEqual(e["raw_claim_count"], 10)
|
|
423
|
+
self.assertFalse(e["truncated"])
|
|
424
|
+
self.assertEqual(e["verifier_kind_counts"]["fact"], 6)
|
|
425
|
+
|
|
426
|
+
def test_emit_confidence_gate_truncation_flag(self):
|
|
427
|
+
audit_emit.emit_confidence_gate(
|
|
428
|
+
claim_count=50,
|
|
429
|
+
pass_count=40,
|
|
430
|
+
fail_count=10,
|
|
431
|
+
verifier_kind_counts={"fact": 50},
|
|
432
|
+
raw_claim_count=200,
|
|
433
|
+
truncated=True,
|
|
434
|
+
)
|
|
435
|
+
e = self._read_one()
|
|
436
|
+
self.assertEqual(e["raw_claim_count"], 200)
|
|
437
|
+
self.assertTrue(e["truncated"])
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class TestStateStoreEmitters(_EmitterTestBase):
|
|
441
|
+
"""emit_state_store_write / read / pruned — P1-QA-4 gaps #2/3/4."""
|
|
442
|
+
|
|
443
|
+
def test_emit_state_store_write_basic(self):
|
|
444
|
+
audit_emit.emit_state_store_write(
|
|
445
|
+
store_name="scratchpad",
|
|
446
|
+
plan_id_hash="abcd1234" * 2, # 16 chars
|
|
447
|
+
key_hash="deadbeef" * 2,
|
|
448
|
+
value_bytes=1024,
|
|
449
|
+
ttl_seconds=3600,
|
|
450
|
+
redaction_applied=True,
|
|
451
|
+
session_id="ssw",
|
|
452
|
+
project="/t",
|
|
453
|
+
)
|
|
454
|
+
e = self._read_one()
|
|
455
|
+
self._assert_schema_baseline(e, "state_store_write")
|
|
456
|
+
self.assertEqual(e["store_name"], "scratchpad")
|
|
457
|
+
self.assertEqual(len(e["plan_id_hash"]), 16)
|
|
458
|
+
self.assertEqual(len(e["key_hash"]), 16)
|
|
459
|
+
self.assertEqual(e["value_bytes"], 1024)
|
|
460
|
+
self.assertEqual(e["ttl_seconds"], 3600)
|
|
461
|
+
self.assertTrue(e["redaction_applied"])
|
|
462
|
+
|
|
463
|
+
def test_emit_state_store_write_null_ttl(self):
|
|
464
|
+
audit_emit.emit_state_store_write(
|
|
465
|
+
store_name="scratchpad",
|
|
466
|
+
plan_id_hash="a" * 16,
|
|
467
|
+
key_hash="b" * 16,
|
|
468
|
+
value_bytes=256,
|
|
469
|
+
ttl_seconds=None,
|
|
470
|
+
)
|
|
471
|
+
e = self._read_one()
|
|
472
|
+
self.assertIsNone(e["ttl_seconds"])
|
|
473
|
+
|
|
474
|
+
def test_emit_state_store_read_basic(self):
|
|
475
|
+
audit_emit.emit_state_store_read(
|
|
476
|
+
store_name="scratchpad",
|
|
477
|
+
plan_id_hash="c" * 16,
|
|
478
|
+
key_hash="d" * 16,
|
|
479
|
+
found=True,
|
|
480
|
+
session_id="ssr",
|
|
481
|
+
project="/t",
|
|
482
|
+
)
|
|
483
|
+
e = self._read_one()
|
|
484
|
+
self._assert_schema_baseline(e, "state_store_read")
|
|
485
|
+
self.assertEqual(e["store_name"], "scratchpad")
|
|
486
|
+
self.assertTrue(e["found"])
|
|
487
|
+
|
|
488
|
+
def test_emit_state_store_read_miss(self):
|
|
489
|
+
audit_emit.emit_state_store_read(
|
|
490
|
+
store_name="scratchpad",
|
|
491
|
+
plan_id_hash="e" * 16,
|
|
492
|
+
key_hash="f" * 16,
|
|
493
|
+
found=False,
|
|
494
|
+
)
|
|
495
|
+
e = self._read_one()
|
|
496
|
+
self.assertFalse(e["found"])
|
|
497
|
+
|
|
498
|
+
def test_emit_state_store_pruned_basic(self):
|
|
499
|
+
audit_emit.emit_state_store_pruned(
|
|
500
|
+
store_name="scratchpad",
|
|
501
|
+
plan_id_hash="9" * 16,
|
|
502
|
+
keys_pruned_count=7,
|
|
503
|
+
session_id="ssp",
|
|
504
|
+
project="/t",
|
|
505
|
+
)
|
|
506
|
+
e = self._read_one()
|
|
507
|
+
self._assert_schema_baseline(e, "state_store_pruned")
|
|
508
|
+
self.assertEqual(e["keys_pruned_count"], 7)
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class TestBudgetAndOtelEmitters(_EmitterTestBase):
|
|
512
|
+
"""emit_budget_exceeded / budget_bypass_used / otel_export_dropped."""
|
|
513
|
+
|
|
514
|
+
def test_emit_budget_exceeded_basic(self):
|
|
515
|
+
audit_emit.emit_budget_exceeded(
|
|
516
|
+
plan_id="PLAN-010",
|
|
517
|
+
spawn_id="spawn-abc",
|
|
518
|
+
tokens_used=50000,
|
|
519
|
+
cap=40000,
|
|
520
|
+
scope="spawn",
|
|
521
|
+
session_id="sbe",
|
|
522
|
+
project="/t",
|
|
523
|
+
)
|
|
524
|
+
e = self._read_one()
|
|
525
|
+
self._assert_schema_baseline(e, "budget_exceeded")
|
|
526
|
+
self.assertEqual(e["plan_id"], "PLAN-010")
|
|
527
|
+
self.assertEqual(e["tokens_used"], 50000)
|
|
528
|
+
self.assertEqual(e["cap"], 40000)
|
|
529
|
+
self.assertEqual(e["scope"], "spawn")
|
|
530
|
+
|
|
531
|
+
def test_emit_budget_bypass_used_basic(self):
|
|
532
|
+
audit_emit.emit_budget_bypass_used(
|
|
533
|
+
plan_id="PLAN-010",
|
|
534
|
+
caller_pid=12345,
|
|
535
|
+
reason="emergency: prod down",
|
|
536
|
+
session_id="sbb",
|
|
537
|
+
project="/t",
|
|
538
|
+
)
|
|
539
|
+
e = self._read_one()
|
|
540
|
+
self._assert_schema_baseline(e, "budget_bypass_used")
|
|
541
|
+
self.assertEqual(e["caller_pid"], 12345)
|
|
542
|
+
self.assertIn("emergency", e["reason_preview"])
|
|
543
|
+
|
|
544
|
+
def test_emit_budget_bypass_used_redacts_secret_in_reason(self):
|
|
545
|
+
audit_emit.emit_budget_bypass_used(
|
|
546
|
+
plan_id="PLAN-010",
|
|
547
|
+
caller_pid=12345,
|
|
548
|
+
reason=f"override for {FAKE_API_KEY} rotation",
|
|
549
|
+
)
|
|
550
|
+
e = self._read_one()
|
|
551
|
+
self.assertNotIn(FAKE_API_KEY, e["reason_preview"])
|
|
552
|
+
self.assertIn(REDACTED_API_KEY_MARKER, e["reason_preview"])
|
|
553
|
+
|
|
554
|
+
def test_emit_otel_export_dropped_basic(self):
|
|
555
|
+
audit_emit.emit_otel_export_dropped(
|
|
556
|
+
fields_dropped_count=3,
|
|
557
|
+
endpoint_host="otel.example.com",
|
|
558
|
+
reason="redaction_applied",
|
|
559
|
+
session_id="soe",
|
|
560
|
+
project="/t",
|
|
561
|
+
)
|
|
562
|
+
e = self._read_one()
|
|
563
|
+
self._assert_schema_baseline(e, "otel_export_dropped")
|
|
564
|
+
self.assertEqual(e["fields_dropped_count"], 3)
|
|
565
|
+
self.assertEqual(e["endpoint_host"], "otel.example.com")
|
|
566
|
+
# Host-only — no URL path / query should be recorded; contract check
|
|
567
|
+
self.assertNotIn("/", e["endpoint_host"])
|
|
568
|
+
self.assertNotIn("?", e["endpoint_host"])
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class TestOutputSafetyFlag(_EmitterTestBase):
|
|
572
|
+
"""emit_output_safety_flag — mirrors injection_flag shape (ADR-036)."""
|
|
573
|
+
|
|
574
|
+
def test_emit_output_safety_flag_basic(self):
|
|
575
|
+
audit_emit.emit_output_safety_flag(
|
|
576
|
+
source="agent-vp-eng",
|
|
577
|
+
family_counts={"prompt_leak": 1},
|
|
578
|
+
match_count=1,
|
|
579
|
+
bytes_scanned=2048,
|
|
580
|
+
redaction_applied=True,
|
|
581
|
+
triggered_by_tool="Agent",
|
|
582
|
+
snippet_preview="sensitive content",
|
|
583
|
+
truncated=False,
|
|
584
|
+
session_id="sosf",
|
|
585
|
+
project="/t",
|
|
586
|
+
)
|
|
587
|
+
e = self._read_one()
|
|
588
|
+
self._assert_schema_baseline(e, "output_safety_flag")
|
|
589
|
+
self.assertEqual(e["source"], "agent-vp-eng")
|
|
590
|
+
self.assertTrue(e["redaction_applied"])
|
|
591
|
+
|
|
592
|
+
def test_emit_output_safety_flag_redacts_secret_in_preview(self):
|
|
593
|
+
audit_emit.emit_output_safety_flag(
|
|
594
|
+
source="agent-out",
|
|
595
|
+
family_counts={"secret_leak": 1},
|
|
596
|
+
match_count=1,
|
|
597
|
+
bytes_scanned=100,
|
|
598
|
+
snippet_preview=f"agent leaked {FAKE_GITHUB_PAT} to output",
|
|
599
|
+
)
|
|
600
|
+
e = self._read_one()
|
|
601
|
+
self.assertNotIn(FAKE_GITHUB_PAT, e["snippet_preview"])
|
|
602
|
+
self.assertIn(REDACTED_PAT_MARKER, e["snippet_preview"])
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
class TestSkillPatchAndSquad(_EmitterTestBase):
|
|
606
|
+
"""emit_skill_patch_applied / squad_imported."""
|
|
607
|
+
|
|
608
|
+
def test_emit_skill_patch_applied_basic(self):
|
|
609
|
+
audit_emit.emit_skill_patch_applied(
|
|
610
|
+
proposal_id="prop-001",
|
|
611
|
+
skill_slug="testing-strategy",
|
|
612
|
+
commit_sha="abc123def456",
|
|
613
|
+
signer_fingerprint="0xDEADBEEF",
|
|
614
|
+
shadow_mode=True,
|
|
615
|
+
session_id="sspa",
|
|
616
|
+
project="/t",
|
|
617
|
+
)
|
|
618
|
+
e = self._read_one()
|
|
619
|
+
self._assert_schema_baseline(e, "skill_patch_applied")
|
|
620
|
+
self.assertEqual(e["proposal_id"], "prop-001")
|
|
621
|
+
self.assertEqual(e["skill_slug"], "testing-strategy")
|
|
622
|
+
self.assertTrue(e["shadow_mode"])
|
|
623
|
+
|
|
624
|
+
def test_emit_squad_imported_basic(self):
|
|
625
|
+
audit_emit.emit_squad_imported(
|
|
626
|
+
squad_name="fintech",
|
|
627
|
+
manifest_sha256="a" * 64,
|
|
628
|
+
signer_fingerprint="0xBEEF",
|
|
629
|
+
source="github.com/acme/squad-edtech@v1",
|
|
630
|
+
session_id="ssi",
|
|
631
|
+
project="/t",
|
|
632
|
+
)
|
|
633
|
+
e = self._read_one()
|
|
634
|
+
self._assert_schema_baseline(e, "squad_imported")
|
|
635
|
+
self.assertEqual(e["squad_name"], "fintech")
|
|
636
|
+
self.assertEqual(len(e["manifest_sha256"]), 64)
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
class TestLiveAdapterEmitters(_EmitterTestBase):
|
|
640
|
+
"""emit_live_adapter_call_started / _succeeded / _failed + breaker +
|
|
641
|
+
credential events (ADR-040 §2/§4/§7)."""
|
|
642
|
+
|
|
643
|
+
def test_emit_live_adapter_call_started_basic(self):
|
|
644
|
+
audit_emit.emit_live_adapter_call_started(
|
|
645
|
+
provider="anthropic",
|
|
646
|
+
url="https://api.anthropic.com/v1/messages",
|
|
647
|
+
attempt=1,
|
|
648
|
+
session_id="sla1",
|
|
649
|
+
project="/t",
|
|
650
|
+
)
|
|
651
|
+
e = self._read_one()
|
|
652
|
+
self._assert_schema_baseline(e, "live_adapter_call_started")
|
|
653
|
+
self.assertEqual(e["provider"], "anthropic")
|
|
654
|
+
self.assertEqual(e["attempt"], 1)
|
|
655
|
+
|
|
656
|
+
def test_emit_live_adapter_call_succeeded_basic(self):
|
|
657
|
+
audit_emit.emit_live_adapter_call_succeeded(
|
|
658
|
+
provider="anthropic",
|
|
659
|
+
url="https://api.anthropic.com/v1/messages",
|
|
660
|
+
status=200,
|
|
661
|
+
duration_ms=450,
|
|
662
|
+
retried=False,
|
|
663
|
+
session_id="sla2",
|
|
664
|
+
project="/t",
|
|
665
|
+
)
|
|
666
|
+
e = self._read_one()
|
|
667
|
+
self._assert_schema_baseline(e, "live_adapter_call_succeeded")
|
|
668
|
+
self.assertEqual(e["status"], 200)
|
|
669
|
+
self.assertEqual(e["duration_ms"], 450)
|
|
670
|
+
self.assertFalse(e["retried"])
|
|
671
|
+
|
|
672
|
+
def test_emit_live_adapter_call_failed_basic(self):
|
|
673
|
+
audit_emit.emit_live_adapter_call_failed(
|
|
674
|
+
provider="anthropic",
|
|
675
|
+
failure_mode="rate_limit",
|
|
676
|
+
http_status=429,
|
|
677
|
+
duration_ms=100,
|
|
678
|
+
retry_count=2,
|
|
679
|
+
session_id="sla3",
|
|
680
|
+
project="/t",
|
|
681
|
+
)
|
|
682
|
+
e = self._read_one()
|
|
683
|
+
self._assert_schema_baseline(e, "live_adapter_call_failed")
|
|
684
|
+
self.assertEqual(e["failure_mode"], "rate_limit")
|
|
685
|
+
self.assertEqual(e["http_status"], 429)
|
|
686
|
+
self.assertEqual(e["retry_count"], 2)
|
|
687
|
+
|
|
688
|
+
def test_emit_live_adapter_call_failed_null_http_status(self):
|
|
689
|
+
audit_emit.emit_live_adapter_call_failed(
|
|
690
|
+
provider="openai",
|
|
691
|
+
failure_mode="connect_timeout",
|
|
692
|
+
http_status=None,
|
|
693
|
+
duration_ms=5000,
|
|
694
|
+
retry_count=3,
|
|
695
|
+
)
|
|
696
|
+
e = self._read_one()
|
|
697
|
+
self.assertIsNone(e["http_status"])
|
|
698
|
+
self.assertEqual(e["failure_mode"], "connect_timeout")
|
|
699
|
+
|
|
700
|
+
def test_emit_breaker_opened_basic(self):
|
|
701
|
+
audit_emit.emit_breaker_opened(
|
|
702
|
+
provider="anthropic",
|
|
703
|
+
failures_in_window=5,
|
|
704
|
+
threshold=3,
|
|
705
|
+
reason="server_error",
|
|
706
|
+
session_id="sbo",
|
|
707
|
+
project="/t",
|
|
708
|
+
)
|
|
709
|
+
e = self._read_one()
|
|
710
|
+
self._assert_schema_baseline(e, "breaker_opened")
|
|
711
|
+
self.assertEqual(e["failures_in_window"], 5)
|
|
712
|
+
self.assertEqual(e["threshold"], 3)
|
|
713
|
+
self.assertEqual(e["reason"], "server_error")
|
|
714
|
+
|
|
715
|
+
def test_emit_breaker_closed_basic(self):
|
|
716
|
+
audit_emit.emit_breaker_closed(
|
|
717
|
+
provider="anthropic",
|
|
718
|
+
from_state="half_open",
|
|
719
|
+
session_id="sbc",
|
|
720
|
+
project="/t",
|
|
721
|
+
)
|
|
722
|
+
e = self._read_one()
|
|
723
|
+
self._assert_schema_baseline(e, "breaker_closed")
|
|
724
|
+
self.assertEqual(e["from_state"], "half_open")
|
|
725
|
+
|
|
726
|
+
def test_emit_credential_rotation_due_basic(self):
|
|
727
|
+
audit_emit.emit_credential_rotation_due(
|
|
728
|
+
provider="anthropic",
|
|
729
|
+
age_days=80,
|
|
730
|
+
warn_threshold_days=75,
|
|
731
|
+
max_threshold_days=90,
|
|
732
|
+
session_id="scrd",
|
|
733
|
+
project="/t",
|
|
734
|
+
)
|
|
735
|
+
e = self._read_one()
|
|
736
|
+
self._assert_schema_baseline(e, "credential_rotation_due")
|
|
737
|
+
self.assertEqual(e["age_days"], 80)
|
|
738
|
+
self.assertEqual(e["warn_threshold_days"], 75)
|
|
739
|
+
self.assertEqual(e["max_threshold_days"], 90)
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
class TestMcpEmitters(_EmitterTestBase):
|
|
743
|
+
"""MCP server events — ADR-042."""
|
|
744
|
+
|
|
745
|
+
def test_emit_mcp_handler_invoked_basic(self):
|
|
746
|
+
audit_emit.emit_mcp_handler_invoked(
|
|
747
|
+
handler="list_plans",
|
|
748
|
+
client_id="a" * 16,
|
|
749
|
+
transport="http",
|
|
750
|
+
duration_ms=12,
|
|
751
|
+
session_id="smhi",
|
|
752
|
+
project="/t",
|
|
753
|
+
)
|
|
754
|
+
e = self._read_one()
|
|
755
|
+
self._assert_schema_baseline(e, "mcp_handler_invoked")
|
|
756
|
+
self.assertEqual(e["handler"], "list_plans")
|
|
757
|
+
self.assertEqual(e["transport"], "http")
|
|
758
|
+
|
|
759
|
+
def test_emit_mcp_handler_denied_basic(self):
|
|
760
|
+
audit_emit.emit_mcp_handler_denied(
|
|
761
|
+
handler="spawn_agent",
|
|
762
|
+
client_id="b" * 16,
|
|
763
|
+
transport="http",
|
|
764
|
+
reason="acl_missing_handler",
|
|
765
|
+
session_id="smhd",
|
|
766
|
+
project="/t",
|
|
767
|
+
)
|
|
768
|
+
e = self._read_one()
|
|
769
|
+
self._assert_schema_baseline(e, "mcp_handler_denied")
|
|
770
|
+
self.assertEqual(e["reason"], "acl_missing_handler")
|
|
771
|
+
|
|
772
|
+
def test_emit_mcp_server_started_basic(self):
|
|
773
|
+
audit_emit.emit_mcp_server_started(
|
|
774
|
+
transport="http",
|
|
775
|
+
host="127.0.0.1",
|
|
776
|
+
port=8765,
|
|
777
|
+
version="1.0.0",
|
|
778
|
+
handlers_count=7,
|
|
779
|
+
session_id="smss",
|
|
780
|
+
project="/t",
|
|
781
|
+
)
|
|
782
|
+
e = self._read_one()
|
|
783
|
+
self._assert_schema_baseline(e, "mcp_server_started")
|
|
784
|
+
self.assertEqual(e["host"], "127.0.0.1")
|
|
785
|
+
self.assertEqual(e["port"], 8765)
|
|
786
|
+
self.assertEqual(e["handlers_count"], 7)
|
|
787
|
+
|
|
788
|
+
def test_emit_mcp_server_started_stdio_zero_port(self):
|
|
789
|
+
audit_emit.emit_mcp_server_started(
|
|
790
|
+
transport="stdio",
|
|
791
|
+
host="",
|
|
792
|
+
port=0,
|
|
793
|
+
version="1.0.0",
|
|
794
|
+
handlers_count=7,
|
|
795
|
+
)
|
|
796
|
+
e = self._read_one()
|
|
797
|
+
self.assertEqual(e["transport"], "stdio")
|
|
798
|
+
self.assertEqual(e["port"], 0)
|
|
799
|
+
|
|
800
|
+
def test_emit_mcp_server_disabled_by_kill_switch_basic(self):
|
|
801
|
+
audit_emit.emit_mcp_server_disabled_by_kill_switch(
|
|
802
|
+
reason="CEO_SOTA_DISABLE=1",
|
|
803
|
+
session_id="smsdks",
|
|
804
|
+
project="/t",
|
|
805
|
+
)
|
|
806
|
+
e = self._read_one()
|
|
807
|
+
self._assert_schema_baseline(e, "mcp_server_disabled_by_kill_switch")
|
|
808
|
+
self.assertEqual(e["reason"], "CEO_SOTA_DISABLE=1")
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
class TestPolicyEngineEmitters(_EmitterTestBase):
|
|
812
|
+
"""Policy engine events (ADR-045 + SPEC/v1/policy-dsl.schema.md)."""
|
|
813
|
+
|
|
814
|
+
def test_emit_policy_evaluated_basic(self):
|
|
815
|
+
audit_emit.emit_policy_evaluated(
|
|
816
|
+
policy_id="bash-safety",
|
|
817
|
+
rule_id="rule-rm-rf",
|
|
818
|
+
decision="allow",
|
|
819
|
+
duration_ms=2,
|
|
820
|
+
session_id="spe",
|
|
821
|
+
project="/t",
|
|
822
|
+
)
|
|
823
|
+
e = self._read_one()
|
|
824
|
+
self._assert_schema_baseline(e, "policy_evaluated")
|
|
825
|
+
self.assertEqual(e["policy_id"], "bash-safety")
|
|
826
|
+
self.assertEqual(e["rule_id"], "rule-rm-rf")
|
|
827
|
+
self.assertIn(e["decision"], {"allow", "deny", "block"})
|
|
828
|
+
|
|
829
|
+
def test_emit_policy_denied_basic(self):
|
|
830
|
+
audit_emit.emit_policy_denied(
|
|
831
|
+
policy_id="bash-safety",
|
|
832
|
+
rule_id="rule-sudo",
|
|
833
|
+
reason="forbidden_command",
|
|
834
|
+
session_id="spd",
|
|
835
|
+
project="/t",
|
|
836
|
+
)
|
|
837
|
+
e = self._read_one()
|
|
838
|
+
self._assert_schema_baseline(e, "policy_denied")
|
|
839
|
+
self.assertEqual(e["reason"], "forbidden_command")
|
|
840
|
+
|
|
841
|
+
def test_emit_policy_error_basic(self):
|
|
842
|
+
audit_emit.emit_policy_error(
|
|
843
|
+
policy_id="bash-safety",
|
|
844
|
+
error_kind="parse_error",
|
|
845
|
+
detail="invalid yaml at line 3",
|
|
846
|
+
session_id="spef",
|
|
847
|
+
project="/t",
|
|
848
|
+
)
|
|
849
|
+
e = self._read_one()
|
|
850
|
+
self._assert_schema_baseline(e, "policy_error")
|
|
851
|
+
self.assertEqual(e["error_kind"], "parse_error")
|
|
852
|
+
self.assertIn("invalid yaml", e["detail"])
|
|
853
|
+
|
|
854
|
+
def test_emit_policy_error_redacts_secret_in_detail(self):
|
|
855
|
+
audit_emit.emit_policy_error(
|
|
856
|
+
policy_id="bash-safety",
|
|
857
|
+
error_kind="predicate_missing",
|
|
858
|
+
detail=f"could not load plugin for {FAKE_API_KEY}",
|
|
859
|
+
)
|
|
860
|
+
e = self._read_one()
|
|
861
|
+
self.assertNotIn(FAKE_API_KEY, e["detail"])
|
|
862
|
+
self.assertIn(REDACTED_API_KEY_MARKER, e["detail"])
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
class TestReplayEmitters(_EmitterTestBase):
|
|
866
|
+
"""Replay events (ADR-046)."""
|
|
867
|
+
|
|
868
|
+
def test_emit_replay_started_basic(self):
|
|
869
|
+
audit_emit.emit_replay_started(
|
|
870
|
+
original_session_id="orig-s-1",
|
|
871
|
+
mode="dry_run",
|
|
872
|
+
redacted_fragments_count=2,
|
|
873
|
+
as_user="alice",
|
|
874
|
+
session_id="srs",
|
|
875
|
+
project="/t",
|
|
876
|
+
)
|
|
877
|
+
e = self._read_one()
|
|
878
|
+
self._assert_schema_baseline(e, "replay_started")
|
|
879
|
+
self.assertEqual(e["mode"], "dry_run")
|
|
880
|
+
self.assertEqual(e["redacted_fragments_count"], 2)
|
|
881
|
+
self.assertEqual(e["as_user"], "alice")
|
|
882
|
+
|
|
883
|
+
def test_emit_replay_completed_basic(self):
|
|
884
|
+
audit_emit.emit_replay_completed(
|
|
885
|
+
original_session_id="orig-s-1",
|
|
886
|
+
mode="execute",
|
|
887
|
+
duration_ms=1500,
|
|
888
|
+
spawn_count=4,
|
|
889
|
+
diff_summary="4 spawns, 1 divergence",
|
|
890
|
+
session_id="src",
|
|
891
|
+
project="/t",
|
|
892
|
+
)
|
|
893
|
+
e = self._read_one()
|
|
894
|
+
self._assert_schema_baseline(e, "replay_completed")
|
|
895
|
+
self.assertEqual(e["duration_ms"], 1500)
|
|
896
|
+
self.assertEqual(e["spawn_count"], 4)
|
|
897
|
+
|
|
898
|
+
def test_emit_replay_diff_produced_basic(self):
|
|
899
|
+
audit_emit.emit_replay_diff_produced(
|
|
900
|
+
original_session_id="orig-s-1",
|
|
901
|
+
spawn_ordinal=2,
|
|
902
|
+
divergence_kind="output_mismatch",
|
|
903
|
+
artifact_path="/tmp/replay/diff-2.md",
|
|
904
|
+
session_id="srd",
|
|
905
|
+
project="/t",
|
|
906
|
+
)
|
|
907
|
+
e = self._read_one()
|
|
908
|
+
self._assert_schema_baseline(e, "replay_diff_produced")
|
|
909
|
+
self.assertEqual(e["spawn_ordinal"], 2)
|
|
910
|
+
self.assertEqual(e["divergence_kind"], "output_mismatch")
|
|
911
|
+
|
|
912
|
+
def test_emit_replay_capture_started_basic(self):
|
|
913
|
+
# PLAN-069 Phase 1 Wave D / ADR-101 — capture mode lifecycle event.
|
|
914
|
+
audit_emit.emit_replay_capture_started(
|
|
915
|
+
original_session_id="orig-s-1",
|
|
916
|
+
redacted_fragments_count=3,
|
|
917
|
+
as_user="alice",
|
|
918
|
+
session_id="srcs",
|
|
919
|
+
project="/t",
|
|
920
|
+
)
|
|
921
|
+
e = self._read_one()
|
|
922
|
+
self._assert_schema_baseline(e, "replay_capture_started")
|
|
923
|
+
self.assertEqual(e["redacted_fragments_count"], 3)
|
|
924
|
+
self.assertEqual(e["as_user"], "alice")
|
|
925
|
+
|
|
926
|
+
def test_emit_replay_capture_completed_basic(self):
|
|
927
|
+
# PLAN-069 Phase 1 Wave D / ADR-101 — capture mode lifecycle event.
|
|
928
|
+
audit_emit.emit_replay_capture_completed(
|
|
929
|
+
original_session_id="orig-s-1",
|
|
930
|
+
duration_ms=750,
|
|
931
|
+
event_count=12,
|
|
932
|
+
fixture_path="state/replay-out/capture-orig-s-1.jsonl",
|
|
933
|
+
session_id="srcc",
|
|
934
|
+
project="/t",
|
|
935
|
+
)
|
|
936
|
+
e = self._read_one()
|
|
937
|
+
self._assert_schema_baseline(e, "replay_capture_completed")
|
|
938
|
+
self.assertEqual(e["duration_ms"], 750)
|
|
939
|
+
self.assertEqual(e["event_count"], 12)
|
|
940
|
+
self.assertEqual(e["fixture_path"], "state/replay-out/capture-orig-s-1.jsonl")
|
|
941
|
+
|
|
942
|
+
def test_emit_ceo_boot_emitted_basic(self):
|
|
943
|
+
# PLAN-065 Phase 2 / ADR-098 (S82 ceremony lote, 2026-05-04) —
|
|
944
|
+
# /ceo-boot session-boot autopilot lifecycle event. Sec MF-3 enforced.
|
|
945
|
+
audit_emit.emit_ceo_boot_emitted(
|
|
946
|
+
gate_pass=True,
|
|
947
|
+
duration_ms=1857,
|
|
948
|
+
checks_total=15,
|
|
949
|
+
checks_failed=0,
|
|
950
|
+
cache_hit=False,
|
|
951
|
+
session_id="ceobs1",
|
|
952
|
+
project="/t",
|
|
953
|
+
)
|
|
954
|
+
e = self._read_one()
|
|
955
|
+
self._assert_schema_baseline(e, "ceo_boot_emitted")
|
|
956
|
+
self.assertEqual(e["gate_pass"], True)
|
|
957
|
+
self.assertEqual(e["duration_ms"], 1857)
|
|
958
|
+
self.assertEqual(e["checks_total"], 15)
|
|
959
|
+
self.assertEqual(e["checks_failed"], 0)
|
|
960
|
+
self.assertEqual(e["cache_hit"], False)
|
|
961
|
+
|
|
962
|
+
def test_emit_ceo_boot_check_skipped_basic(self):
|
|
963
|
+
# PLAN-065 Phase 2 / ADR-098 (S82 ceremony lote, 2026-05-04) —
|
|
964
|
+
# /ceo-boot per-check timeout/aggregate-skip event.
|
|
965
|
+
audit_emit.emit_ceo_boot_check_skipped(
|
|
966
|
+
check_name="governance_validate",
|
|
967
|
+
timeout_ms=2500,
|
|
968
|
+
session_id="ceobs2",
|
|
969
|
+
project="/t",
|
|
970
|
+
)
|
|
971
|
+
e = self._read_one()
|
|
972
|
+
self._assert_schema_baseline(e, "ceo_boot_check_skipped")
|
|
973
|
+
self.assertEqual(e["check_name"], "governance_validate")
|
|
974
|
+
self.assertEqual(e["timeout_ms"], 2500)
|
|
975
|
+
|
|
976
|
+
def test_emit_mcp_canonical_guard_blocked_basic(self):
|
|
977
|
+
# PLAN-070 / ADR-102 (S85 ceremony, 2026-05-05) — Layer B server-side
|
|
978
|
+
# MCP canonical-guard middleware fired when a custom mcp__* tool tries
|
|
979
|
+
# to write a canonical-guarded path without a sentinel. Sec MF-3 field
|
|
980
|
+
# allowlist enforced via _MCP_CANONICAL_GUARD_BLOCKED_ALLOWLIST.
|
|
981
|
+
# Closes ADR-095 §gate-#6 NG-06.
|
|
982
|
+
audit_emit.emit_generic(
|
|
983
|
+
"mcp_canonical_guard_blocked",
|
|
984
|
+
tool_name="mcp__codex__apply_patch",
|
|
985
|
+
target_path=".claude/hooks/_lib/audit_emit.py",
|
|
986
|
+
reason="canonical_path_no_sentinel",
|
|
987
|
+
session_id="mcgb1",
|
|
988
|
+
project="/t",
|
|
989
|
+
)
|
|
990
|
+
e = self._read_one()
|
|
991
|
+
self._assert_schema_baseline(e, "mcp_canonical_guard_blocked")
|
|
992
|
+
self.assertEqual(e["tool_name"], "mcp__codex__apply_patch")
|
|
993
|
+
self.assertEqual(e["target_path"], ".claude/hooks/_lib/audit_emit.py")
|
|
994
|
+
self.assertEqual(e["reason"], "canonical_path_no_sentinel")
|
|
995
|
+
|
|
996
|
+
def test_emit_mcp_canonical_guard_allowed_basic(self):
|
|
997
|
+
# PLAN-070 / ADR-102 (S85 ceremony, 2026-05-05) — Layer B server-side
|
|
998
|
+
# MCP canonical-guard middleware fired when a custom mcp__* tool's
|
|
999
|
+
# write is permitted (non-canonical target, or canonical with valid
|
|
1000
|
+
# sentinel). Sec MF-3 field allowlist enforced via
|
|
1001
|
+
# _MCP_CANONICAL_GUARD_ALLOWED_ALLOWLIST.
|
|
1002
|
+
audit_emit.emit_generic(
|
|
1003
|
+
"mcp_canonical_guard_allowed",
|
|
1004
|
+
tool_name="mcp__codex__apply_patch",
|
|
1005
|
+
target_path="docs/some-doc.md",
|
|
1006
|
+
reason="non_canonical_path",
|
|
1007
|
+
session_id="mcga1",
|
|
1008
|
+
project="/t",
|
|
1009
|
+
)
|
|
1010
|
+
e = self._read_one()
|
|
1011
|
+
self._assert_schema_baseline(e, "mcp_canonical_guard_allowed")
|
|
1012
|
+
self.assertEqual(e["tool_name"], "mcp__codex__apply_patch")
|
|
1013
|
+
self.assertEqual(e["target_path"], "docs/some-doc.md")
|
|
1014
|
+
self.assertEqual(e["reason"], "non_canonical_path")
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
class TestPlan071AdaptiveExecutionKernel(_EmitterTestBase):
|
|
1018
|
+
"""PLAN-071 / ADR-104 (S87 ceremony, 2026-05-05) — Adaptive Execution
|
|
1019
|
+
Kernel + Reality Ledger advisory events. Sec MF-3 field allowlists
|
|
1020
|
+
enforced via _TASK_ROUTE_ADVISED_ALLOWLIST + _REALITY_LEDGER_FINDING_ALLOWLIST.
|
|
1021
|
+
Per-action smoke tests close the test_audit_emit_coverage.py gate."""
|
|
1022
|
+
|
|
1023
|
+
def test_emit_task_route_advised_basic(self):
|
|
1024
|
+
audit_emit.emit_generic(
|
|
1025
|
+
"task_route_advised",
|
|
1026
|
+
contract_id="task-route-test-1",
|
|
1027
|
+
classification="M",
|
|
1028
|
+
task_description_hmac="abcd" * 16,
|
|
1029
|
+
duration_ms=12,
|
|
1030
|
+
session_id="tra1",
|
|
1031
|
+
project="/t",
|
|
1032
|
+
)
|
|
1033
|
+
e = self._read_one()
|
|
1034
|
+
self._assert_schema_baseline(e, "task_route_advised")
|
|
1035
|
+
self.assertEqual(e["contract_id"], "task-route-test-1")
|
|
1036
|
+
self.assertEqual(e["classification"], "M")
|
|
1037
|
+
self.assertEqual(e["duration_ms"], 12)
|
|
1038
|
+
|
|
1039
|
+
def test_emit_task_route_key_dropped_basic(self):
|
|
1040
|
+
# Defense-in-depth breadcrumb fires when scrub strips forbidden
|
|
1041
|
+
# caller fields. Synthesize a payload with a forbidden field
|
|
1042
|
+
# (e.g. raw task description) to trigger drop + breadcrumb.
|
|
1043
|
+
audit_emit.emit_generic(
|
|
1044
|
+
"task_route_advised",
|
|
1045
|
+
contract_id="task-route-test-2",
|
|
1046
|
+
classification="S",
|
|
1047
|
+
task_description_hmac=None,
|
|
1048
|
+
duration_ms=5,
|
|
1049
|
+
session_id="trkd1",
|
|
1050
|
+
project="/t",
|
|
1051
|
+
# Forbidden field — must be stripped:
|
|
1052
|
+
raw_task_description="this should NEVER appear in audit-log",
|
|
1053
|
+
)
|
|
1054
|
+
# Read the emit + locate the forbidden-key breadcrumb.
|
|
1055
|
+
# PLAN-114 F-1-1.8-47dba028: the scrub now also emits a typed
|
|
1056
|
+
# task_route_key_dropped event into the HMAC-covered trail, so the log
|
|
1057
|
+
# holds two events; locate the finding by action (order not asserted).
|
|
1058
|
+
events = self._read_events()
|
|
1059
|
+
self.assertGreaterEqual(len(events), 1)
|
|
1060
|
+
advised = [e for e in events if e.get("action") == "task_route_advised"]
|
|
1061
|
+
self.assertEqual(len(advised), 1, f"expected one task_route_advised: {events!r}")
|
|
1062
|
+
self._assert_schema_baseline(advised[0], "task_route_advised")
|
|
1063
|
+
# Forbidden field must NOT be persisted in the finding event
|
|
1064
|
+
self.assertNotIn("raw_task_description", advised[0])
|
|
1065
|
+
# Defense-in-depth: a typed key-dropped event is now emitted, and it
|
|
1066
|
+
# likewise never carries the forbidden field.
|
|
1067
|
+
dropped_ev = [e for e in events if e.get("action") == "task_route_key_dropped"]
|
|
1068
|
+
self.assertEqual(len(dropped_ev), 1, "task_route_key_dropped not emitted")
|
|
1069
|
+
self.assertNotIn("raw_task_description", dropped_ev[0])
|
|
1070
|
+
|
|
1071
|
+
def test_emit_reality_ledger_finding_basic(self):
|
|
1072
|
+
# confidence_bps: int 0..1000 (replaces float "confidence").
|
|
1073
|
+
# The allowlist now contains "confidence_bps"; float "confidence"
|
|
1074
|
+
# is dropped by the scrub branch (CanonicalJsonError fix).
|
|
1075
|
+
audit_emit.emit_generic(
|
|
1076
|
+
"reality_ledger_finding",
|
|
1077
|
+
detector="installable_claim_drift",
|
|
1078
|
+
severity="high",
|
|
1079
|
+
confidence_bps=990, # 0.99 × 1000
|
|
1080
|
+
claim_source_sha256="ab" * 32,
|
|
1081
|
+
finding_count_in_run=1,
|
|
1082
|
+
session_id="rlf1",
|
|
1083
|
+
project="/t",
|
|
1084
|
+
)
|
|
1085
|
+
e = self._read_one()
|
|
1086
|
+
self._assert_schema_baseline(e, "reality_ledger_finding")
|
|
1087
|
+
self.assertEqual(e["detector"], "installable_claim_drift")
|
|
1088
|
+
self.assertEqual(e["severity"], "high")
|
|
1089
|
+
self.assertEqual(e["confidence_bps"], 990)
|
|
1090
|
+
self.assertIsInstance(e["confidence_bps"], int)
|
|
1091
|
+
self.assertNotIn("confidence", e, "old float field must not appear")
|
|
1092
|
+
|
|
1093
|
+
def test_emit_reality_ledger_key_dropped_basic(self):
|
|
1094
|
+
# Same defense-in-depth pattern: forbidden field stripped.
|
|
1095
|
+
audit_emit.emit_generic(
|
|
1096
|
+
"reality_ledger_finding",
|
|
1097
|
+
detector="runtime_read_missing",
|
|
1098
|
+
severity="medium",
|
|
1099
|
+
confidence_bps=800, # 0.8 × 1000
|
|
1100
|
+
claim_source_sha256="cd" * 32,
|
|
1101
|
+
finding_count_in_run=1,
|
|
1102
|
+
session_id="rlkd1",
|
|
1103
|
+
project="/t",
|
|
1104
|
+
# Forbidden field — must be stripped:
|
|
1105
|
+
claim_source_path="/leaked/absolute/path.md",
|
|
1106
|
+
)
|
|
1107
|
+
# PLAN-114 F-1-1.8-8d4e2519: scrub now also emits a typed
|
|
1108
|
+
# reality_ledger_key_dropped event into the HMAC-covered trail, so the
|
|
1109
|
+
# log holds two events; locate the finding by action (order-agnostic).
|
|
1110
|
+
events = self._read_events()
|
|
1111
|
+
self.assertGreaterEqual(len(events), 1)
|
|
1112
|
+
finding = [e for e in events if e.get("action") == "reality_ledger_finding"]
|
|
1113
|
+
self.assertEqual(len(finding), 1, f"expected one reality_ledger_finding: {events!r}")
|
|
1114
|
+
self._assert_schema_baseline(finding[0], "reality_ledger_finding")
|
|
1115
|
+
# claim_source_path MUST NOT leak (R-SEC2 contract)
|
|
1116
|
+
self.assertNotIn("claim_source_path", finding[0])
|
|
1117
|
+
# Defense-in-depth: a typed key-dropped event is now emitted, and it
|
|
1118
|
+
# likewise never carries the forbidden absolute path.
|
|
1119
|
+
dropped_ev = [e for e in events if e.get("action") == "reality_ledger_key_dropped"]
|
|
1120
|
+
self.assertEqual(len(dropped_ev), 1, "reality_ledger_key_dropped not emitted")
|
|
1121
|
+
self.assertNotIn("claim_source_path", dropped_ev[0])
|
|
1122
|
+
|
|
1123
|
+
# ------------------------------------------------------------------
|
|
1124
|
+
# PLAN-078 Wave 1 — emit_model_routing_advised (S89 Fase 1 commit
|
|
1125
|
+
# 2cb1472, registered in test contract S92 Wave 1b ceremony).
|
|
1126
|
+
# Sec MF-3 enforced via _MODEL_ROUTING_ADVISED_ALLOWLIST.
|
|
1127
|
+
# ------------------------------------------------------------------
|
|
1128
|
+
def test_emit_model_routing_advised_basic(self):
|
|
1129
|
+
# Use the typed emitter so the [0..1000] confidence_basis_points clamp
|
|
1130
|
+
# is exercised. 8500 would clamp to 1000 (basis-points are 0..1000,
|
|
1131
|
+
# NOT 0..10000 as the legacy raw value 8500 implied).
|
|
1132
|
+
audit_emit.emit_model_routing_advised(
|
|
1133
|
+
archetype="qa-architect",
|
|
1134
|
+
task_type="adversarial",
|
|
1135
|
+
model_recommended="claude-opus-4-8",
|
|
1136
|
+
confidence_basis_points=850, # 0.85 confidence × 1000
|
|
1137
|
+
applied_or_skipped="applied",
|
|
1138
|
+
session_id="mra1",
|
|
1139
|
+
project="/t",
|
|
1140
|
+
)
|
|
1141
|
+
e = self._read_one()
|
|
1142
|
+
self._assert_schema_baseline(e, "model_routing_advised")
|
|
1143
|
+
self.assertEqual(e["archetype"], "qa-architect")
|
|
1144
|
+
self.assertEqual(e["task_type"], "adversarial")
|
|
1145
|
+
self.assertEqual(e["model_recommended"], "claude-opus-4-8")
|
|
1146
|
+
self.assertEqual(e["confidence_basis_points"], 850)
|
|
1147
|
+
self.assertEqual(e["applied_or_skipped"], "applied")
|
|
1148
|
+
# Confidence is 0..1000 basis-points (NOT 0..10000)
|
|
1149
|
+
self.assertGreaterEqual(e["confidence_basis_points"], 0)
|
|
1150
|
+
self.assertLessEqual(e["confidence_basis_points"], 1000)
|
|
1151
|
+
|
|
1152
|
+
# ------------------------------------------------------------------
|
|
1153
|
+
# PLAN-078 Wave 2 — emit_estimate_drift_detected (per-plan drift)
|
|
1154
|
+
# Sec MF-3 enforced via _ESTIMATE_DRIFT_DETECTED_ALLOWLIST.
|
|
1155
|
+
# Drift factors emitted as int basis-points (1234 = 1.234×).
|
|
1156
|
+
# ------------------------------------------------------------------
|
|
1157
|
+
def test_emit_estimate_drift_detected_basic(self):
|
|
1158
|
+
# Use the typed emitter (NOT emit_generic) so enum-clamping behavior
|
|
1159
|
+
# is exercised. systematic_bias_direction enum is `underestimate`
|
|
1160
|
+
# (overrun, factor>1.2) / `overestimate` (underrun, factor<0.83) /
|
|
1161
|
+
# `""` per Codex W1+W2 fix-pack #3. Our test passes the canonical
|
|
1162
|
+
# `underestimate` value used by the production code path.
|
|
1163
|
+
audit_emit.emit_estimate_drift_detected(
|
|
1164
|
+
plan_id="PLAN-001",
|
|
1165
|
+
drift_factor_compute_basis_points=2500,
|
|
1166
|
+
drift_factor_owner_basis_points=1500,
|
|
1167
|
+
severity="medium",
|
|
1168
|
+
plan_count_in_run=1,
|
|
1169
|
+
systematic_bias_direction="underestimate",
|
|
1170
|
+
session_id="edd1",
|
|
1171
|
+
project="/t",
|
|
1172
|
+
)
|
|
1173
|
+
e = self._read_one()
|
|
1174
|
+
self._assert_schema_baseline(e, "estimate_drift_detected")
|
|
1175
|
+
self.assertEqual(e["plan_id"], "PLAN-001")
|
|
1176
|
+
self.assertEqual(e["drift_factor_compute_basis_points"], 2500)
|
|
1177
|
+
self.assertEqual(e["severity"], "medium")
|
|
1178
|
+
self.assertEqual(e["systematic_bias_direction"], "underestimate")
|
|
1179
|
+
# Drift factors are integer basis-points (1234 = 1.234×) — never floats
|
|
1180
|
+
self.assertIsInstance(e["drift_factor_compute_basis_points"], int)
|
|
1181
|
+
self.assertIsInstance(e["drift_factor_owner_basis_points"], int)
|
|
1182
|
+
|
|
1183
|
+
# ------------------------------------------------------------------
|
|
1184
|
+
# PLAN-078 Wave 2 — emit_estimate_drift_systematic_bias (cross-plan)
|
|
1185
|
+
# Sec MF-3 enforced via _ESTIMATE_DRIFT_SYSTEMATIC_BIAS_ALLOWLIST.
|
|
1186
|
+
# bias_direction enum: `underestimate` / `overestimate` only — caller
|
|
1187
|
+
# values outside the enum are clamped to `underestimate` (default) by
|
|
1188
|
+
# the typed emitter.
|
|
1189
|
+
# ------------------------------------------------------------------
|
|
1190
|
+
def test_emit_estimate_drift_systematic_bias_basic(self):
|
|
1191
|
+
audit_emit.emit_estimate_drift_systematic_bias(
|
|
1192
|
+
bias_direction="overestimate",
|
|
1193
|
+
plans_affected_count=5,
|
|
1194
|
+
avg_drift_factor_compute_basis_points=750,
|
|
1195
|
+
avg_drift_factor_owner_basis_points=850,
|
|
1196
|
+
session_id="edsb1",
|
|
1197
|
+
project="/t",
|
|
1198
|
+
)
|
|
1199
|
+
e = self._read_one()
|
|
1200
|
+
self._assert_schema_baseline(e, "estimate_drift_systematic_bias")
|
|
1201
|
+
self.assertEqual(e["bias_direction"], "overestimate")
|
|
1202
|
+
self.assertEqual(e["plans_affected_count"], 5)
|
|
1203
|
+
# Avg drift factors are integer basis-points
|
|
1204
|
+
self.assertIsInstance(e["avg_drift_factor_compute_basis_points"], int)
|
|
1205
|
+
|
|
1206
|
+
# ------------------------------------------------------------------
|
|
1207
|
+
# PLAN-078 Wave 5 (S95 ceremony 2026-05-08) —
|
|
1208
|
+
# emit_ceo_boot_task_candidate_emitted (TaskCreate-candidate orchestration).
|
|
1209
|
+
# Sec MF-3 enforced via _CEO_BOOT_TASK_CANDIDATE_EMITTED_ALLOWLIST.
|
|
1210
|
+
# 4 caller fields: rank (1..3), severity (low/medium/high), subject_hash
|
|
1211
|
+
# (12-hex prefix of sha256(NFKC(visible Subject))), awaiting_confirm (bool).
|
|
1212
|
+
# ------------------------------------------------------------------
|
|
1213
|
+
def test_emit_ceo_boot_task_candidate_emitted_basic(self):
|
|
1214
|
+
audit_emit.emit_ceo_boot_task_candidate_emitted(
|
|
1215
|
+
session_id="ctc1",
|
|
1216
|
+
rank=1,
|
|
1217
|
+
severity="high",
|
|
1218
|
+
subject_hash="840915797aa1",
|
|
1219
|
+
awaiting_confirm=False,
|
|
1220
|
+
project="/t",
|
|
1221
|
+
)
|
|
1222
|
+
e = self._read_one()
|
|
1223
|
+
self._assert_schema_baseline(e, "ceo_boot_task_candidate_emitted")
|
|
1224
|
+
self.assertEqual(e["rank"], 1)
|
|
1225
|
+
self.assertEqual(e["severity"], "high")
|
|
1226
|
+
self.assertEqual(e["subject_hash"], "840915797aa1")
|
|
1227
|
+
self.assertFalse(e["awaiting_confirm"])
|
|
1228
|
+
# Sec MF-3 boundary: subject text NEVER persisted
|
|
1229
|
+
self.assertNotIn("subject", e)
|
|
1230
|
+
self.assertNotIn("recommendation", e)
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
class TestPredictiveBudget(_EmitterTestBase):
|
|
1234
|
+
"""emit_prediction_queried — ADR-047 (NO raw dollar figures)."""
|
|
1235
|
+
|
|
1236
|
+
def test_emit_prediction_queried_basic(self):
|
|
1237
|
+
audit_emit.emit_prediction_queried(
|
|
1238
|
+
plan_id="PLAN-015",
|
|
1239
|
+
bucket_range="100k-130k",
|
|
1240
|
+
confidence="medium",
|
|
1241
|
+
training_window_plans=20,
|
|
1242
|
+
session_id="spq",
|
|
1243
|
+
project="/t",
|
|
1244
|
+
)
|
|
1245
|
+
e = self._read_one()
|
|
1246
|
+
self._assert_schema_baseline(e, "prediction_queried")
|
|
1247
|
+
self.assertEqual(e["plan_id"], "PLAN-015")
|
|
1248
|
+
self.assertEqual(e["bucket_range"], "100k-130k")
|
|
1249
|
+
self.assertEqual(e["confidence"], "medium")
|
|
1250
|
+
# Sensitivity contract: bucket_range uses "Xk-Yk" form, never $
|
|
1251
|
+
self.assertNotIn("$", e["bucket_range"])
|
|
1252
|
+
|
|
1253
|
+
def test_emit_prediction_queried_cold_start_confidence(self):
|
|
1254
|
+
audit_emit.emit_prediction_queried(
|
|
1255
|
+
plan_id="PLAN-001",
|
|
1256
|
+
bucket_range="unknown",
|
|
1257
|
+
confidence="cold_start",
|
|
1258
|
+
training_window_plans=0,
|
|
1259
|
+
)
|
|
1260
|
+
e = self._read_one()
|
|
1261
|
+
self.assertEqual(e["confidence"], "cold_start")
|
|
1262
|
+
self.assertEqual(e["training_window_plans"], 0)
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
class TestPatternMemoryEmitters(_EmitterTestBase):
|
|
1266
|
+
"""Cross-plan memory events (ADR-048)."""
|
|
1267
|
+
|
|
1268
|
+
def test_emit_pattern_stored_basic(self):
|
|
1269
|
+
audit_emit.emit_pattern_stored(
|
|
1270
|
+
topic="debate-round-1",
|
|
1271
|
+
content_hash="a" * 64,
|
|
1272
|
+
size_bytes=2048,
|
|
1273
|
+
session_id="sps",
|
|
1274
|
+
project="/t",
|
|
1275
|
+
)
|
|
1276
|
+
e = self._read_one()
|
|
1277
|
+
self._assert_schema_baseline(e, "pattern_stored")
|
|
1278
|
+
self.assertEqual(e["topic"], "debate-round-1")
|
|
1279
|
+
self.assertEqual(len(e["content_hash"]), 64)
|
|
1280
|
+
self.assertEqual(e["size_bytes"], 2048)
|
|
1281
|
+
|
|
1282
|
+
def test_emit_pattern_queried_basic(self):
|
|
1283
|
+
audit_emit.emit_pattern_queried(
|
|
1284
|
+
topic="debate-round-1",
|
|
1285
|
+
k=5,
|
|
1286
|
+
match_count=3,
|
|
1287
|
+
session_id="spq2",
|
|
1288
|
+
project="/t",
|
|
1289
|
+
)
|
|
1290
|
+
e = self._read_one()
|
|
1291
|
+
self._assert_schema_baseline(e, "pattern_queried")
|
|
1292
|
+
self.assertEqual(e["k"], 5)
|
|
1293
|
+
self.assertEqual(e["match_count"], 3)
|
|
1294
|
+
|
|
1295
|
+
def test_emit_pattern_evicted_basic(self):
|
|
1296
|
+
audit_emit.emit_pattern_evicted(
|
|
1297
|
+
topic="debate-round-1",
|
|
1298
|
+
content_hash="b" * 64,
|
|
1299
|
+
reason="admin_request",
|
|
1300
|
+
session_id="spev",
|
|
1301
|
+
project="/t",
|
|
1302
|
+
)
|
|
1303
|
+
e = self._read_one()
|
|
1304
|
+
self._assert_schema_baseline(e, "pattern_evicted")
|
|
1305
|
+
self.assertEqual(e["reason"], "admin_request")
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
class TestThreatModelEmitters(_EmitterTestBase):
|
|
1309
|
+
"""Threat-model governance (Phase C)."""
|
|
1310
|
+
|
|
1311
|
+
def test_emit_threat_model_promoted_basic(self):
|
|
1312
|
+
audit_emit.emit_threat_model_promoted(
|
|
1313
|
+
from_status="draft",
|
|
1314
|
+
to_status="accepted",
|
|
1315
|
+
accepted_by="owner@example.com",
|
|
1316
|
+
commit_sha="abc123",
|
|
1317
|
+
session_id="stmp",
|
|
1318
|
+
project="/t",
|
|
1319
|
+
)
|
|
1320
|
+
e = self._read_one()
|
|
1321
|
+
self._assert_schema_baseline(e, "threat_model_promoted")
|
|
1322
|
+
self.assertEqual(e["from_status"], "draft")
|
|
1323
|
+
self.assertEqual(e["to_status"], "accepted")
|
|
1324
|
+
self.assertEqual(e["accepted_by"], "owner@example.com")
|
|
1325
|
+
|
|
1326
|
+
def test_emit_threat_model_freshness_breach_basic(self):
|
|
1327
|
+
audit_emit.emit_threat_model_freshness_breach(
|
|
1328
|
+
new_adr_count_since_review=3,
|
|
1329
|
+
threshold=2,
|
|
1330
|
+
session_id="stmfb",
|
|
1331
|
+
project="/t",
|
|
1332
|
+
)
|
|
1333
|
+
e = self._read_one()
|
|
1334
|
+
self._assert_schema_baseline(e, "threat_model_freshness_breach")
|
|
1335
|
+
self.assertEqual(e["new_adr_count_since_review"], 3)
|
|
1336
|
+
self.assertEqual(e["threshold"], 2)
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
# -----------------------------------------------------------------------------
|
|
1340
|
+
# FileLock / concurrent-write hygiene
|
|
1341
|
+
# -----------------------------------------------------------------------------
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
class TestConcurrentEmitHygiene(_EmitterTestBase):
|
|
1345
|
+
"""3-thread stress test: every JSONL line must be well-formed."""
|
|
1346
|
+
|
|
1347
|
+
def test_concurrent_emit_state_store_write_no_torn_lines(self):
|
|
1348
|
+
N_THREADS = 3
|
|
1349
|
+
N_PER_THREAD = 20
|
|
1350
|
+
|
|
1351
|
+
def worker(tid: int) -> None:
|
|
1352
|
+
for i in range(N_PER_THREAD):
|
|
1353
|
+
audit_emit.emit_state_store_write(
|
|
1354
|
+
store_name=f"store-{tid}",
|
|
1355
|
+
plan_id_hash=f"{tid:04x}{i:012x}"[:16],
|
|
1356
|
+
key_hash=f"{i:016x}",
|
|
1357
|
+
value_bytes=100 + i,
|
|
1358
|
+
ttl_seconds=3600,
|
|
1359
|
+
redaction_applied=False,
|
|
1360
|
+
session_id=f"stress-{tid}",
|
|
1361
|
+
project="/t",
|
|
1362
|
+
)
|
|
1363
|
+
|
|
1364
|
+
threads = [threading.Thread(target=worker, args=(t,)) for t in range(N_THREADS)]
|
|
1365
|
+
for t in threads:
|
|
1366
|
+
t.start()
|
|
1367
|
+
for t in threads:
|
|
1368
|
+
t.join()
|
|
1369
|
+
|
|
1370
|
+
# Every line must parse as JSON (no torn writes) and action must
|
|
1371
|
+
# match. Under FileLock we expect ALL events to land successfully.
|
|
1372
|
+
log_path = Path(os.environ["CEO_AUDIT_LOG_PATH"])
|
|
1373
|
+
self.assertTrue(log_path.exists(), "audit log was not created")
|
|
1374
|
+
lines = [ln for ln in log_path.read_text(encoding="utf-8").splitlines() if ln.strip()]
|
|
1375
|
+
self.assertEqual(
|
|
1376
|
+
len(lines),
|
|
1377
|
+
N_THREADS * N_PER_THREAD,
|
|
1378
|
+
"some events were dropped under concurrent writes",
|
|
1379
|
+
)
|
|
1380
|
+
for line in lines:
|
|
1381
|
+
# Parses as JSON — no torn writes
|
|
1382
|
+
event = json.loads(line)
|
|
1383
|
+
self.assertEqual(event["action"], "state_store_write")
|
|
1384
|
+
# Reserved fields present
|
|
1385
|
+
self.assertEqual(event["event_schema"], "v2")
|
|
1386
|
+
self.assertIn("ts", event)
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
# -----------------------------------------------------------------------------
|
|
1390
|
+
# Unknown action rejection (fail-open contract)
|
|
1391
|
+
# -----------------------------------------------------------------------------
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
class TestUnknownActionRejection(_EmitterTestBase):
|
|
1395
|
+
"""_write_event MUST reject unknown actions with a breadcrumb."""
|
|
1396
|
+
|
|
1397
|
+
def test_unknown_action_writes_breadcrumb_not_log(self):
|
|
1398
|
+
audit_emit._write_event({
|
|
1399
|
+
"action": "not_a_real_action_xyz",
|
|
1400
|
+
"session_id": "s",
|
|
1401
|
+
"project": "/t",
|
|
1402
|
+
})
|
|
1403
|
+
# Audit log should NOT have the event
|
|
1404
|
+
self.assertEqual(self._read_events(), [])
|
|
1405
|
+
# Breadcrumb should record the rejection
|
|
1406
|
+
errors = self.read_audit_errors()
|
|
1407
|
+
self.assertIn("unknown action", errors)
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
# -----------------------------------------------------------------------------
|
|
1411
|
+
# Drift-safe enumeration gate
|
|
1412
|
+
# -----------------------------------------------------------------------------
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
def _collect_tested_actions_in_module() -> set:
|
|
1416
|
+
"""Extract every `test_emit_<action>_<concern>` method name present in
|
|
1417
|
+
this module and derive the action from the method name.
|
|
1418
|
+
|
|
1419
|
+
Algorithm: greedy longest-prefix match against `_KNOWN_ACTIONS`. This
|
|
1420
|
+
is robust to multi-word actions (e.g. ``live_adapter_call_started``)
|
|
1421
|
+
without hardcoding how many underscores separate action from concern.
|
|
1422
|
+
"""
|
|
1423
|
+
module = sys.modules[__name__]
|
|
1424
|
+
methods: List[str] = []
|
|
1425
|
+
for _, cls in inspect.getmembers(module, inspect.isclass):
|
|
1426
|
+
if not issubclass(cls, unittest.TestCase):
|
|
1427
|
+
continue
|
|
1428
|
+
for name, _member in inspect.getmembers(cls, predicate=inspect.isfunction):
|
|
1429
|
+
if name.startswith("test_emit_"):
|
|
1430
|
+
methods.append(name)
|
|
1431
|
+
|
|
1432
|
+
known_sorted = sorted(audit_emit._KNOWN_ACTIONS, key=len, reverse=True)
|
|
1433
|
+
tested: set = set()
|
|
1434
|
+
for name in methods:
|
|
1435
|
+
stem = name[len("test_emit_"):] # strip prefix
|
|
1436
|
+
matched = None
|
|
1437
|
+
for action in known_sorted:
|
|
1438
|
+
if stem == action or stem.startswith(action + "_"):
|
|
1439
|
+
matched = action
|
|
1440
|
+
break
|
|
1441
|
+
if matched is not None:
|
|
1442
|
+
tested.add(matched)
|
|
1443
|
+
return tested
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
class TestEmitterCoverageGate(unittest.TestCase):
|
|
1447
|
+
"""Drift-safe gate: every `_KNOWN_ACTIONS` entry MUST have a test.
|
|
1448
|
+
|
|
1449
|
+
If someone adds `emit_new_thing` to `audit_emit._KNOWN_ACTIONS` and
|
|
1450
|
+
forgets to add a `test_emit_new_thing_basic` method here, this test
|
|
1451
|
+
fails with a clear diff listing the uncovered actions.
|
|
1452
|
+
"""
|
|
1453
|
+
|
|
1454
|
+
# PLAN-019 dynamic-findings defer list (per the test's own error message
|
|
1455
|
+
# contract). Each entry has a tracking ticket / plan reference for the
|
|
1456
|
+
# test method backfill. Coverage gap is documented, not silent.
|
|
1457
|
+
_DEFERRED_COVERAGE = frozenset({
|
|
1458
|
+
# PLAN-084 Wave 0.5 ceremony closures — test methods deferred to
|
|
1459
|
+
# PLAN-091 kernel-hardening sweep per ADR-115 maintenance-mode.
|
|
1460
|
+
"canonical_edit_attempted",
|
|
1461
|
+
"canonical_edit_blocked",
|
|
1462
|
+
"gpg_signed",
|
|
1463
|
+
"gpg_verified",
|
|
1464
|
+
"sentinel_verified",
|
|
1465
|
+
"sentinel_created",
|
|
1466
|
+
"wave_artifact_written",
|
|
1467
|
+
"wave_readonly_violation",
|
|
1468
|
+
"pair_rail_outgoing_redaction_applied",
|
|
1469
|
+
"estimate_refined",
|
|
1470
|
+
# PLAN-085 v1.19.0 Wave C — test methods covered by dedicated test
|
|
1471
|
+
# files (tests/test_credential_rotation_emit.py +
|
|
1472
|
+
# tests/test_live_adapter_allowlist_runtime.py +
|
|
1473
|
+
# tests/test_mcp_bearer_nonce_replay.py); the EmitterCoverageGate
|
|
1474
|
+
# contract requires a method in *this* file. Defer backfill to
|
|
1475
|
+
# PLAN-091 per ADR-115 maintenance-mode (functional coverage already
|
|
1476
|
+
# exists in dedicated suites; this is gate-format alignment only).
|
|
1477
|
+
"live_adapter_blocked",
|
|
1478
|
+
"credential_blocked_due_to_age",
|
|
1479
|
+
"credential_emergency_override_used",
|
|
1480
|
+
# PLAN-117 WS-A (S176) — credential_override_late_set_ignored. Functional
|
|
1481
|
+
# coverage via tests/test_credential_rotation_emit.py (trust-root snapshot
|
|
1482
|
+
# source + ticket regex fail-CLOSED + late-set forensic emit). In-module
|
|
1483
|
+
# EmitterCoverageGate method deferred (mirrors the Wave C credential cluster).
|
|
1484
|
+
"credential_override_late_set_ignored",
|
|
1485
|
+
"mcp_bearer_replay_rejected",
|
|
1486
|
+
"mcp_non_loopback_rejected",
|
|
1487
|
+
# PLAN-085 v1.19.0 Wave G.1b — ATLAS-tagged actions; functional
|
|
1488
|
+
# coverage via tests/test_atlas_technique_id_tagging.py (15 cases).
|
|
1489
|
+
"prompt_injection_detected",
|
|
1490
|
+
"secret_leak_detected",
|
|
1491
|
+
"pii_redacted_outgoing",
|
|
1492
|
+
"codex_egress_redacted",
|
|
1493
|
+
# PLAN-085 v1.19.0 Wave E.4 piggyback — emitted by
|
|
1494
|
+
# check_bash_canonical_forensic.py; advisory PostToolUse audit.
|
|
1495
|
+
# Functional coverage via .claude/hooks/tests/test_bash_canonical_forensic.py.
|
|
1496
|
+
"canonical_edit_completed",
|
|
1497
|
+
# PLAN-086 v1.20.0 Wave B/C/D/G (S112 2026-05-12). Functional coverage
|
|
1498
|
+
# via dedicated suites (test_model_routing*.py + test_mcp_routing*.py
|
|
1499
|
+
# + test_check_codex_response.py); EmitterCoverageGate contract
|
|
1500
|
+
# requires a method in *this* file. Backfill deferred to PLAN-093
|
|
1501
|
+
# Tier-5 finalization per ADR-115 maintenance-mode.
|
|
1502
|
+
"anthropic_429_observed",
|
|
1503
|
+
"codex-reply",
|
|
1504
|
+
"codex_invoke_dispatched",
|
|
1505
|
+
"git_index_lock_retry",
|
|
1506
|
+
"mcp_canonical_guard_internal_error",
|
|
1507
|
+
"mcp_route_advised",
|
|
1508
|
+
"repo_profile_confirmed",
|
|
1509
|
+
"subagent_findings_partial_drop",
|
|
1510
|
+
"thinking_budget_set",
|
|
1511
|
+
# PLAN-088 v1.22.0 Wave 1 canonical-13 (S114 2026-05-13). Functional
|
|
1512
|
+
# coverage via test_audit_emit_plan088_canonical13.py (dedicated
|
|
1513
|
+
# canonical-13 suite); EmitterCoverageGate format alignment deferred
|
|
1514
|
+
# to PLAN-093 Tier-5 finalization per ADR-115 maintenance-mode.
|
|
1515
|
+
"batch_dispatched",
|
|
1516
|
+
"cache_discipline_alerted",
|
|
1517
|
+
"cookbook_pattern_advised",
|
|
1518
|
+
"estimate_calibrator_pipeline_run",
|
|
1519
|
+
"first_run_wizard_dispatched",
|
|
1520
|
+
"pair_rail_phase_advanced",
|
|
1521
|
+
"tier_policy_misrouting_advised",
|
|
1522
|
+
# PLAN-089 v1.23.0 Wave A.4 + B.3 + C (S117 2026-05-13). Functional
|
|
1523
|
+
# coverage via test_sentinel_signers.py + test_check_bash_safety.py +
|
|
1524
|
+
# test_kernel_extension_emit.py dedicated suites; format alignment
|
|
1525
|
+
# deferred to PLAN-096+ per ADR-124 post-audit-SOTA-execution-mode.
|
|
1526
|
+
"bash_canonical_bypass_invoked",
|
|
1527
|
+
"kernel_extension_landed",
|
|
1528
|
+
"sentinel_signer_quorum_failed",
|
|
1529
|
+
"sentinel_signer_quorum_attempted",
|
|
1530
|
+
"sentinel_signer_rotated",
|
|
1531
|
+
"sentinel_signer_revoked",
|
|
1532
|
+
"sentinel_signer_expiry_warned",
|
|
1533
|
+
# PLAN-090 v1.24.0 Wave B + C + AMENDMENT-1 + D (S118 2026-05-13).
|
|
1534
|
+
# Functional coverage via test_claude_batch_adapter.py +
|
|
1535
|
+
# test_mcp_bearer_friction_emit.py + test_kill_switch_godmode_enforcing.py +
|
|
1536
|
+
# test_phase_c_advisory_audit.py + test_confidence_gate_emit.py +
|
|
1537
|
+
# test_capability_rollout_complete.py dedicated suites; format
|
|
1538
|
+
# alignment deferred per ADR-124 + ADR-115 maintenance discipline.
|
|
1539
|
+
"streaming_token_yielded",
|
|
1540
|
+
"streaming_rate_capped",
|
|
1541
|
+
"mcp_bearer_friction_observed",
|
|
1542
|
+
"phase_c_enforcing_flipped",
|
|
1543
|
+
"kill_switch_invoked",
|
|
1544
|
+
"confidence_gate_baseline_emitted",
|
|
1545
|
+
"capability_rollout_complete",
|
|
1546
|
+
# PLAN-091 / PLAN-088 persona auto decision telemetry.
|
|
1547
|
+
"persona_auto_decision_emitted",
|
|
1548
|
+
"persona_auto_rate_capped",
|
|
1549
|
+
# PLAN-093 v1.26.0 Wave C.5 (S123 2026-05-14) — /ceo-boot persona-coverage
|
|
1550
|
+
# matrix emitter. Functional coverage via /ceo-boot smoke + ceo-boot.py
|
|
1551
|
+
# `check_ceo_boot_persona_coverage_score` unit; EmitterCoverageGate
|
|
1552
|
+
# format alignment deferred per ADR-124 maintenance discipline.
|
|
1553
|
+
"ceo_boot_persona_coverage_score",
|
|
1554
|
+
# PLAN-094 v1.27.0-pending Wave A (S124 2026-05-15) — ADR-055-AMEND-1
|
|
1555
|
+
# spool-writer drain forensic events. Functional coverage will arrive
|
|
1556
|
+
# with the Wave A.7 22-test pack at
|
|
1557
|
+
# `.claude/hooks/tests/test_audit_emit_async_flush.py` (skeleton landed
|
|
1558
|
+
# this ceremony; full pack TBD post Wave A.3 audit_emit hot-path
|
|
1559
|
+
# integration). EmitterCoverageGate format alignment in this file
|
|
1560
|
+
# deferred per ADR-124 maintenance discipline.
|
|
1561
|
+
"audit_flush_dropped_count",
|
|
1562
|
+
"audit_spool_stale_recovered",
|
|
1563
|
+
"audit_spool_partial_line_discarded",
|
|
1564
|
+
"audit_spool_tamper_detected",
|
|
1565
|
+
"audit_spool_duplicate_tuple_rejected",
|
|
1566
|
+
"audit_spool_intentionally_deleted",
|
|
1567
|
+
"audit_spool_unexpected_skip",
|
|
1568
|
+
# PLAN-094 Wave B (R-039, S124) — smart-loading frontmatter cache stats.
|
|
1569
|
+
# Functional coverage via .claude/scripts/tests/test_smart_loading_resolver.py
|
|
1570
|
+
# TestPlan094WaveBFrontmatterCache (6 tests, all GREEN). EmitterCoverageGate
|
|
1571
|
+
# format alignment in *this* file deferred per ADR-124 maintenance.
|
|
1572
|
+
"skill_cache_stats",
|
|
1573
|
+
# PLAN-116 (S172) — tier_policy_loader_fallback_observed. Full functional
|
|
1574
|
+
# coverage via test_tier_policy_loader_fallback_observed.py (9 tests:
|
|
1575
|
+
# closed-enum accept-all-14-slugs, allowlist-subset, out-of-enum drop,
|
|
1576
|
+
# typed emitter, loader integration). In-module EmitterCoverageGate
|
|
1577
|
+
# method deferred (mirrors skill_cache_stats / canonical-13 precedent).
|
|
1578
|
+
"tier_policy_loader_fallback_observed",
|
|
1579
|
+
# PLAN-124 WS-1 (ECC value-harvest) — git_hook_bypass_blocked. Full
|
|
1580
|
+
# functional coverage via test_git_bypass_guard.py (block fixtures,
|
|
1581
|
+
# must-allow regression corpus, dual-auth on/off, no-leak assertion,
|
|
1582
|
+
# closed-enum coercion, emit_generic second-line-of-defense). In-module
|
|
1583
|
+
# EmitterCoverageGate method deferred (mirrors the lifecycle / canonical-13
|
|
1584
|
+
# precedent; the gate only scans methods defined in *this* file).
|
|
1585
|
+
"git_hook_bypass_blocked",
|
|
1586
|
+
})
|
|
1587
|
+
|
|
1588
|
+
@pytest.mark.xfail(
|
|
1589
|
+
strict=True,
|
|
1590
|
+
reason=(
|
|
1591
|
+
"74 emit_* actions without matching test_emit_* methods at "
|
|
1592
|
+
"HEAD (gap recomputed via _collect_tested_actions_in_module: "
|
|
1593
|
+
"_KNOWN_ACTIONS=263, tested=127, _DEFERRED_COVERAGE=62). The "
|
|
1594
|
+
"former '44' was stale (predated PLAN-094..S185 action growth). "
|
|
1595
|
+
"Defer remaining backfill to the coverage-completion plan "
|
|
1596
|
+
"(S169 B-scope Batch B2); residual enumerated in "
|
|
1597
|
+
"PLAN-120-FOLLOWUP/receipts/bscope-disposition.md §5."
|
|
1598
|
+
),
|
|
1599
|
+
)
|
|
1600
|
+
def test_every_known_action_has_test_method(self):
|
|
1601
|
+
known = set(audit_emit._KNOWN_ACTIONS)
|
|
1602
|
+
tested = _collect_tested_actions_in_module()
|
|
1603
|
+
missing = (known - tested) - self._DEFERRED_COVERAGE
|
|
1604
|
+
self.assertFalse(
|
|
1605
|
+
missing,
|
|
1606
|
+
"Audit emitters without tests in this file: "
|
|
1607
|
+
f"{sorted(missing)}. Add test_emit_<action>_basic methods or "
|
|
1608
|
+
"document the defer in _DEFERRED_COVERAGE.",
|
|
1609
|
+
)
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
class TestWaveAEmitters(_EmitterTestBase):
|
|
1613
|
+
"""PLAN-028 Wave A lifecycle + PLAN-029 output-scan emitters (ADR-056/057).
|
|
1614
|
+
|
|
1615
|
+
Verifies emit_session_start / _end / _prompt_submitted / _stop +
|
|
1616
|
+
emit_output_scan_finding write valid JSONL rows via emit_generic
|
|
1617
|
+
dispatcher.
|
|
1618
|
+
"""
|
|
1619
|
+
|
|
1620
|
+
def test_emit_session_start_basic(self):
|
|
1621
|
+
audit_emit.emit_session_start(
|
|
1622
|
+
session_id="s-start",
|
|
1623
|
+
hook_version="1.0.0",
|
|
1624
|
+
governance_state="healthy",
|
|
1625
|
+
gate_1_hashes={"CLAUDE.md": "abc123"},
|
|
1626
|
+
warmup_bytes=12345,
|
|
1627
|
+
project="/t",
|
|
1628
|
+
)
|
|
1629
|
+
e = self._read_one()
|
|
1630
|
+
self._assert_schema_baseline(e, "session_start")
|
|
1631
|
+
self.assertEqual(e["session_id"], "s-start")
|
|
1632
|
+
self.assertEqual(e["governance_state"], "healthy")
|
|
1633
|
+
|
|
1634
|
+
def test_emit_session_end_basic(self):
|
|
1635
|
+
audit_emit.emit_session_end(
|
|
1636
|
+
session_id="s-end",
|
|
1637
|
+
hook_version="1.0.0",
|
|
1638
|
+
reason="normal",
|
|
1639
|
+
memory_writable=True,
|
|
1640
|
+
memory_index_present=True,
|
|
1641
|
+
project="/t",
|
|
1642
|
+
)
|
|
1643
|
+
e = self._read_one()
|
|
1644
|
+
self._assert_schema_baseline(e, "session_end")
|
|
1645
|
+
self.assertEqual(e["reason"], "normal")
|
|
1646
|
+
self.assertTrue(e["memory_writable"])
|
|
1647
|
+
|
|
1648
|
+
def test_emit_prompt_submitted_basic(self):
|
|
1649
|
+
audit_emit.emit_prompt_submitted(
|
|
1650
|
+
session_id="s-prompt",
|
|
1651
|
+
hook_version="1.0.0",
|
|
1652
|
+
prompt_len_bucket="<=500",
|
|
1653
|
+
prompt_sha256="abc123def456",
|
|
1654
|
+
redact_hits_count=2,
|
|
1655
|
+
injection_family_counts={"direct_override": 1},
|
|
1656
|
+
project="/t",
|
|
1657
|
+
)
|
|
1658
|
+
e = self._read_one()
|
|
1659
|
+
self._assert_schema_baseline(e, "prompt_submitted")
|
|
1660
|
+
self.assertEqual(e["prompt_len_bucket"], "<=500")
|
|
1661
|
+
self.assertEqual(e["redact_hits_count"], 2)
|
|
1662
|
+
|
|
1663
|
+
def test_emit_session_stop_basic(self):
|
|
1664
|
+
audit_emit.emit_session_stop(
|
|
1665
|
+
session_id="s-stop",
|
|
1666
|
+
hook_version="1.0.0",
|
|
1667
|
+
reason="user_stop",
|
|
1668
|
+
partial_state_saved=False,
|
|
1669
|
+
project="/t",
|
|
1670
|
+
)
|
|
1671
|
+
e = self._read_one()
|
|
1672
|
+
self._assert_schema_baseline(e, "session_stop")
|
|
1673
|
+
self.assertEqual(e["reason"], "user_stop")
|
|
1674
|
+
self.assertFalse(e["partial_state_saved"])
|
|
1675
|
+
|
|
1676
|
+
def test_emit_output_scan_finding_basic(self):
|
|
1677
|
+
audit_emit.emit_output_scan_finding(
|
|
1678
|
+
session_id="s-scan",
|
|
1679
|
+
tool_name="Bash",
|
|
1680
|
+
hook_version="1.0.0",
|
|
1681
|
+
total_findings=3,
|
|
1682
|
+
family_counts={"unicode_injection": 2, "telemetry_string": 1},
|
|
1683
|
+
kill_switched={"master": False, "unicode": False},
|
|
1684
|
+
project="/t",
|
|
1685
|
+
)
|
|
1686
|
+
e = self._read_one()
|
|
1687
|
+
self._assert_schema_baseline(e, "output_scan_finding")
|
|
1688
|
+
self.assertEqual(e["total_findings"], 3)
|
|
1689
|
+
self.assertEqual(e["tool_name"], "Bash")
|
|
1690
|
+
|
|
1691
|
+
def test_emit_generic_rejects_unknown_action(self):
|
|
1692
|
+
"""emit_generic validates action against _KNOWN_ACTIONS."""
|
|
1693
|
+
# Event written via unknown action should NOT land in log
|
|
1694
|
+
audit_emit.emit_generic(
|
|
1695
|
+
"definitely_not_a_known_action",
|
|
1696
|
+
session_id="s-bogus",
|
|
1697
|
+
project="/t",
|
|
1698
|
+
)
|
|
1699
|
+
# Log should be empty (action rejected)
|
|
1700
|
+
log_path = audit_emit._log_path()
|
|
1701
|
+
if log_path.is_file():
|
|
1702
|
+
content = log_path.read_text(encoding="utf-8").strip()
|
|
1703
|
+
# If there's content, it should not contain the bogus action
|
|
1704
|
+
self.assertNotIn("definitely_not_a_known_action", content)
|
|
1705
|
+
|
|
1706
|
+
# PLAN-041 Wave A+ (ADR-062) — RAG sidecar events go via emit_generic
|
|
1707
|
+
# through .claude/hooks/_lib/rag_events.py typed wrappers. These tests
|
|
1708
|
+
# exercise each action via emit_generic directly (coverage gate
|
|
1709
|
+
# requires one test_emit_<action>_basic per _KNOWN_ACTIONS entry).
|
|
1710
|
+
|
|
1711
|
+
def test_emit_rag_query_issued_basic(self):
|
|
1712
|
+
audit_emit.emit_generic(
|
|
1713
|
+
"rag_query_issued",
|
|
1714
|
+
session_id="rag-s-1",
|
|
1715
|
+
method="rag.search",
|
|
1716
|
+
timeout_ms=5000,
|
|
1717
|
+
bridge_version="1.0.0",
|
|
1718
|
+
project="/t",
|
|
1719
|
+
)
|
|
1720
|
+
e = self._read_one()
|
|
1721
|
+
self._assert_schema_baseline(e, "rag_query_issued")
|
|
1722
|
+
self.assertEqual(e["method"], "rag.search")
|
|
1723
|
+
self.assertEqual(e["timeout_ms"], 5000)
|
|
1724
|
+
|
|
1725
|
+
def test_emit_rag_query_returned_basic(self):
|
|
1726
|
+
audit_emit.emit_generic(
|
|
1727
|
+
"rag_query_returned",
|
|
1728
|
+
session_id="rag-s-2",
|
|
1729
|
+
method="rag.search",
|
|
1730
|
+
chunks_returned=5,
|
|
1731
|
+
chunks_dropped=2,
|
|
1732
|
+
bridge_version="1.0.0",
|
|
1733
|
+
project="/t",
|
|
1734
|
+
)
|
|
1735
|
+
e = self._read_one()
|
|
1736
|
+
self._assert_schema_baseline(e, "rag_query_returned")
|
|
1737
|
+
self.assertEqual(e["chunks_returned"], 5)
|
|
1738
|
+
self.assertEqual(e["chunks_dropped"], 2)
|
|
1739
|
+
|
|
1740
|
+
def test_emit_rag_query_fallback_basic(self):
|
|
1741
|
+
audit_emit.emit_generic(
|
|
1742
|
+
"rag_query_fallback",
|
|
1743
|
+
session_id="rag-s-3",
|
|
1744
|
+
method="rag.search",
|
|
1745
|
+
reason="socket_missing",
|
|
1746
|
+
bridge_version="1.0.0",
|
|
1747
|
+
project="/t",
|
|
1748
|
+
)
|
|
1749
|
+
e = self._read_one()
|
|
1750
|
+
self._assert_schema_baseline(e, "rag_query_fallback")
|
|
1751
|
+
self.assertEqual(e["reason"], "socket_missing")
|
|
1752
|
+
|
|
1753
|
+
def test_emit_rag_query_redacted_basic(self):
|
|
1754
|
+
audit_emit.emit_generic(
|
|
1755
|
+
"rag_query_redacted",
|
|
1756
|
+
session_id="rag-s-4",
|
|
1757
|
+
chunk_keys=["file", "snippet"],
|
|
1758
|
+
family_counts={"LLM01_prompt_injection": 2},
|
|
1759
|
+
bridge_version="1.0.0",
|
|
1760
|
+
project="/t",
|
|
1761
|
+
)
|
|
1762
|
+
e = self._read_one()
|
|
1763
|
+
self._assert_schema_baseline(e, "rag_query_redacted")
|
|
1764
|
+
self.assertEqual(e["chunk_keys"], ["file", "snippet"])
|
|
1765
|
+
|
|
1766
|
+
def test_emit_rag_index_redacted_basic(self):
|
|
1767
|
+
audit_emit.emit_generic(
|
|
1768
|
+
"rag_index_redacted",
|
|
1769
|
+
session_id="rag-s-5",
|
|
1770
|
+
file_path=".env.production",
|
|
1771
|
+
reason="LLM06_sensitive_info",
|
|
1772
|
+
family_counts={"LLM06_sensitive_info": 1},
|
|
1773
|
+
indexer_version="1.0.0",
|
|
1774
|
+
project="/t",
|
|
1775
|
+
)
|
|
1776
|
+
e = self._read_one()
|
|
1777
|
+
self._assert_schema_baseline(e, "rag_index_redacted")
|
|
1778
|
+
self.assertEqual(e["file_path"], ".env.production")
|
|
1779
|
+
self.assertEqual(e["reason"], "LLM06_sensitive_info")
|
|
1780
|
+
|
|
1781
|
+
# ------------------------------------------------------------------
|
|
1782
|
+
# PLAN-043 Wave B (ADR-064) — dynamic tier-policy learned dispatch
|
|
1783
|
+
# ------------------------------------------------------------------
|
|
1784
|
+
# All 9 tier_policy_* actions are emitted via emit_generic from
|
|
1785
|
+
# .claude/scripts/tier_policy_cli/{learn,apply,cli}.py. They share a
|
|
1786
|
+
# common shape (role, task_type, current_tier, policy_sha) and
|
|
1787
|
+
# vary only in the transition kind. One smoke test per action is
|
|
1788
|
+
# sufficient to satisfy the coverage gate — the full behavioral
|
|
1789
|
+
# tests live alongside each emitter in the tier_policy module.
|
|
1790
|
+
|
|
1791
|
+
def test_emit_tier_policy_derived_basic(self):
|
|
1792
|
+
audit_emit.emit_generic(
|
|
1793
|
+
"tier_policy_derived",
|
|
1794
|
+
session_id="tp-s-1",
|
|
1795
|
+
role="qa-architect",
|
|
1796
|
+
task_type="test-design",
|
|
1797
|
+
derived_tier="sonnet",
|
|
1798
|
+
n_samples=30,
|
|
1799
|
+
gap_pp=25.0,
|
|
1800
|
+
project="/t",
|
|
1801
|
+
)
|
|
1802
|
+
e = self._read_one()
|
|
1803
|
+
self._assert_schema_baseline(e, "tier_policy_derived")
|
|
1804
|
+
self.assertEqual(e["role"], "qa-architect")
|
|
1805
|
+
|
|
1806
|
+
def test_emit_tier_policy_promote_applied_basic(self):
|
|
1807
|
+
audit_emit.emit_generic(
|
|
1808
|
+
"tier_policy_promote_applied",
|
|
1809
|
+
session_id="tp-s-2",
|
|
1810
|
+
role="devops",
|
|
1811
|
+
previous_tier="haiku",
|
|
1812
|
+
new_tier="sonnet",
|
|
1813
|
+
policy_sha="a" * 64,
|
|
1814
|
+
project="/t",
|
|
1815
|
+
)
|
|
1816
|
+
e = self._read_one()
|
|
1817
|
+
self._assert_schema_baseline(e, "tier_policy_promote_applied")
|
|
1818
|
+
|
|
1819
|
+
def test_emit_tier_policy_promote_cost_gated_basic(self):
|
|
1820
|
+
audit_emit.emit_generic(
|
|
1821
|
+
"tier_policy_promote_cost_gated",
|
|
1822
|
+
session_id="tp-s-3",
|
|
1823
|
+
role="performance-engineer",
|
|
1824
|
+
projected_monthly_usd=150.0,
|
|
1825
|
+
cap_monthly_usd=100.0,
|
|
1826
|
+
project="/t",
|
|
1827
|
+
)
|
|
1828
|
+
e = self._read_one()
|
|
1829
|
+
self._assert_schema_baseline(e, "tier_policy_promote_cost_gated")
|
|
1830
|
+
|
|
1831
|
+
def test_emit_tier_policy_demote_requested_basic(self):
|
|
1832
|
+
audit_emit.emit_generic(
|
|
1833
|
+
"tier_policy_demote_requested",
|
|
1834
|
+
session_id="tp-s-4",
|
|
1835
|
+
role="qa-architect",
|
|
1836
|
+
from_tier="opus",
|
|
1837
|
+
to_tier="sonnet",
|
|
1838
|
+
owner_signed=True,
|
|
1839
|
+
project="/t",
|
|
1840
|
+
)
|
|
1841
|
+
e = self._read_one()
|
|
1842
|
+
self._assert_schema_baseline(e, "tier_policy_demote_requested")
|
|
1843
|
+
|
|
1844
|
+
def test_emit_tier_policy_rejected_basic(self):
|
|
1845
|
+
audit_emit.emit_generic(
|
|
1846
|
+
"tier_policy_rejected",
|
|
1847
|
+
session_id="tp-s-5",
|
|
1848
|
+
role="devops",
|
|
1849
|
+
reason="veto_floor",
|
|
1850
|
+
project="/t",
|
|
1851
|
+
)
|
|
1852
|
+
e = self._read_one()
|
|
1853
|
+
self._assert_schema_baseline(e, "tier_policy_rejected")
|
|
1854
|
+
|
|
1855
|
+
def test_emit_tier_policy_hmac_verify_failed_basic(self):
|
|
1856
|
+
audit_emit.emit_generic(
|
|
1857
|
+
"tier_policy_hmac_verify_failed",
|
|
1858
|
+
session_id="tp-s-6",
|
|
1859
|
+
report_path="/tmp/report.jsonl",
|
|
1860
|
+
reason="chain_break",
|
|
1861
|
+
project="/t",
|
|
1862
|
+
)
|
|
1863
|
+
e = self._read_one()
|
|
1864
|
+
self._assert_schema_baseline(e, "tier_policy_hmac_verify_failed")
|
|
1865
|
+
|
|
1866
|
+
def test_emit_tier_policy_killswitch_triggered_basic(self):
|
|
1867
|
+
audit_emit.emit_generic(
|
|
1868
|
+
"tier_policy_killswitch_triggered",
|
|
1869
|
+
session_id="tp-s-7",
|
|
1870
|
+
factor_env=True,
|
|
1871
|
+
factor_sentinel=True,
|
|
1872
|
+
project="/t",
|
|
1873
|
+
)
|
|
1874
|
+
e = self._read_one()
|
|
1875
|
+
self._assert_schema_baseline(e, "tier_policy_killswitch_triggered")
|
|
1876
|
+
|
|
1877
|
+
def test_emit_tier_policy_adopter_override_respected_basic(self):
|
|
1878
|
+
audit_emit.emit_generic(
|
|
1879
|
+
"tier_policy_adopter_override_respected",
|
|
1880
|
+
session_id="tp-s-8",
|
|
1881
|
+
role="devops",
|
|
1882
|
+
adopter_tier="haiku",
|
|
1883
|
+
learned_tier="sonnet",
|
|
1884
|
+
project="/t",
|
|
1885
|
+
)
|
|
1886
|
+
e = self._read_one()
|
|
1887
|
+
self._assert_schema_baseline(
|
|
1888
|
+
e, "tier_policy_adopter_override_respected"
|
|
1889
|
+
)
|
|
1890
|
+
|
|
1891
|
+
def test_emit_tier_policy_dry_run_complete_basic(self):
|
|
1892
|
+
audit_emit.emit_generic(
|
|
1893
|
+
"tier_policy_dry_run_complete",
|
|
1894
|
+
session_id="tp-s-9",
|
|
1895
|
+
changes_count=3,
|
|
1896
|
+
diff_sha="b" * 64,
|
|
1897
|
+
project="/t",
|
|
1898
|
+
)
|
|
1899
|
+
e = self._read_one()
|
|
1900
|
+
self._assert_schema_baseline(e, "tier_policy_dry_run_complete")
|
|
1901
|
+
|
|
1902
|
+
def test_no_test_references_unknown_action(self):
|
|
1903
|
+
"""Guard against typos: every action we claim to test MUST be in
|
|
1904
|
+
`_KNOWN_ACTIONS`. Protects against a renamed action leaving a
|
|
1905
|
+
stale test method behind that silently no-ops.
|
|
1906
|
+
"""
|
|
1907
|
+
known = set(audit_emit._KNOWN_ACTIONS)
|
|
1908
|
+
tested = _collect_tested_actions_in_module()
|
|
1909
|
+
extras = tested - known
|
|
1910
|
+
self.assertFalse(
|
|
1911
|
+
extras,
|
|
1912
|
+
f"Test methods reference actions not in _KNOWN_ACTIONS: {sorted(extras)}",
|
|
1913
|
+
)
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
# ============================================================================
|
|
1917
|
+
# PLAN-045 P2 coverage polish (Session 42) — 8 tournament_* emitters added by
|
|
1918
|
+
# PLAN-032 Wave B. Each uses ``emit_generic(action, ...)`` dispatch; the tests
|
|
1919
|
+
# here exercise the basic write-path + _KNOWN_ACTIONS allowlist match.
|
|
1920
|
+
# ============================================================================
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
class TestTournamentEmitters(_EmitterTestBase):
|
|
1924
|
+
"""PLAN-032 Wave B tournament audit actions — basic emission per-action."""
|
|
1925
|
+
|
|
1926
|
+
def _emit_and_read(self, action: str, **extra: Any) -> Dict[str, Any]:
|
|
1927
|
+
audit_emit.emit_generic(
|
|
1928
|
+
action=action,
|
|
1929
|
+
session_id=f"s-{action}",
|
|
1930
|
+
project="/t",
|
|
1931
|
+
**extra,
|
|
1932
|
+
)
|
|
1933
|
+
return self._read_one()
|
|
1934
|
+
|
|
1935
|
+
def test_emit_tournament_run_started_basic(self):
|
|
1936
|
+
e = self._emit_and_read("tournament_run_started", run_id="run-1")
|
|
1937
|
+
self._assert_schema_baseline(e, "tournament_run_started")
|
|
1938
|
+
|
|
1939
|
+
def test_emit_tournament_task_scored_basic(self):
|
|
1940
|
+
e = self._emit_and_read(
|
|
1941
|
+
"tournament_task_scored", run_id="run-1", task_id="t-1", score=0.42,
|
|
1942
|
+
)
|
|
1943
|
+
self._assert_schema_baseline(e, "tournament_task_scored")
|
|
1944
|
+
|
|
1945
|
+
def test_emit_tournament_run_completed_basic(self):
|
|
1946
|
+
e = self._emit_and_read(
|
|
1947
|
+
"tournament_run_completed", run_id="run-1", winner="claude-opus-4-8",
|
|
1948
|
+
)
|
|
1949
|
+
self._assert_schema_baseline(e, "tournament_run_completed")
|
|
1950
|
+
|
|
1951
|
+
def test_emit_tournament_budget_projected_basic(self):
|
|
1952
|
+
e = self._emit_and_read(
|
|
1953
|
+
"tournament_budget_projected", run_id="run-1", projected_cost_usd=12.50,
|
|
1954
|
+
)
|
|
1955
|
+
self._assert_schema_baseline(e, "tournament_budget_projected")
|
|
1956
|
+
|
|
1957
|
+
def test_emit_tournament_budget_exceeded_basic(self):
|
|
1958
|
+
e = self._emit_and_read(
|
|
1959
|
+
"tournament_budget_exceeded", run_id="run-1", cap_usd=75, spent_usd=80,
|
|
1960
|
+
)
|
|
1961
|
+
self._assert_schema_baseline(e, "tournament_budget_exceeded")
|
|
1962
|
+
|
|
1963
|
+
def test_emit_tournament_aborted_basic(self):
|
|
1964
|
+
e = self._emit_and_read(
|
|
1965
|
+
"tournament_aborted", run_id="run-1", reason="budget_exceeded",
|
|
1966
|
+
)
|
|
1967
|
+
self._assert_schema_baseline(e, "tournament_aborted")
|
|
1968
|
+
|
|
1969
|
+
def test_emit_tournament_fixture_rejected_basic(self):
|
|
1970
|
+
e = self._emit_and_read(
|
|
1971
|
+
"tournament_fixture_rejected",
|
|
1972
|
+
fixture_id="fx-001",
|
|
1973
|
+
reason="unicode_attack",
|
|
1974
|
+
)
|
|
1975
|
+
self._assert_schema_baseline(e, "tournament_fixture_rejected")
|
|
1976
|
+
|
|
1977
|
+
def test_emit_tournament_judge_hijack_suspected_basic(self):
|
|
1978
|
+
e = self._emit_and_read(
|
|
1979
|
+
"tournament_judge_hijack_suspected",
|
|
1980
|
+
run_id="run-1",
|
|
1981
|
+
jaccard_similarity=0.85,
|
|
1982
|
+
)
|
|
1983
|
+
self._assert_schema_baseline(e, "tournament_judge_hijack_suspected")
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
# ============================================================================
|
|
1987
|
+
# PLAN-045 Wave 5 round-8 (Session 43) — 4 new emitters: fluency_nudge +
|
|
1988
|
+
# skill_reference_read_{mismatch,stale,never_read}. Registered via
|
|
1989
|
+
# kernel-batch-wave-5.py. Each uses ``emit_generic(action, ...)`` dispatch.
|
|
1990
|
+
# ============================================================================
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
class TestWave5Emitters(_EmitterTestBase):
|
|
1994
|
+
"""PLAN-045 Wave 5 round-8 audit actions — basic emission per-action."""
|
|
1995
|
+
|
|
1996
|
+
def _emit_and_read(self, action: str, **extra: Any) -> Dict[str, Any]:
|
|
1997
|
+
audit_emit.emit_generic(
|
|
1998
|
+
action=action,
|
|
1999
|
+
session_id=f"s-{action}",
|
|
2000
|
+
project="/t",
|
|
2001
|
+
**extra,
|
|
2002
|
+
)
|
|
2003
|
+
return self._read_one()
|
|
2004
|
+
|
|
2005
|
+
def test_emit_fluency_nudge_basic(self):
|
|
2006
|
+
e = self._emit_and_read(
|
|
2007
|
+
"fluency_nudge",
|
|
2008
|
+
marker_count=5,
|
|
2009
|
+
threshold_crossed=2,
|
|
2010
|
+
markers_matched=["all done", "tests green"],
|
|
2011
|
+
output_length=300,
|
|
2012
|
+
)
|
|
2013
|
+
self._assert_schema_baseline(e, "fluency_nudge")
|
|
2014
|
+
|
|
2015
|
+
def test_emit_skill_reference_read_mismatch_basic(self):
|
|
2016
|
+
e = self._emit_and_read(
|
|
2017
|
+
"skill_reference_read_mismatch",
|
|
2018
|
+
skill_path=".claude/skills/core/x/SKILL.md",
|
|
2019
|
+
claimed_sha="a" * 64,
|
|
2020
|
+
read_sha="b" * 64,
|
|
2021
|
+
spawn_ts="2026-04-20T12:00:00Z",
|
|
2022
|
+
read_ts="2026-04-20T12:00:03Z",
|
|
2023
|
+
)
|
|
2024
|
+
self._assert_schema_baseline(e, "skill_reference_read_mismatch")
|
|
2025
|
+
|
|
2026
|
+
def test_emit_skill_reference_read_stale_basic(self):
|
|
2027
|
+
e = self._emit_and_read(
|
|
2028
|
+
"skill_reference_read_stale",
|
|
2029
|
+
skill_path=".claude/skills/core/x/SKILL.md",
|
|
2030
|
+
claimed_sha="a" * 64,
|
|
2031
|
+
read_sha="a" * 64,
|
|
2032
|
+
spawn_ts="2026-04-20T12:00:00Z",
|
|
2033
|
+
read_ts="2026-04-20T12:10:00Z",
|
|
2034
|
+
delta_seconds=600,
|
|
2035
|
+
)
|
|
2036
|
+
self._assert_schema_baseline(e, "skill_reference_read_stale")
|
|
2037
|
+
|
|
2038
|
+
def test_emit_skill_reference_never_read_basic(self):
|
|
2039
|
+
e = self._emit_and_read(
|
|
2040
|
+
"skill_reference_never_read",
|
|
2041
|
+
skill_path=".claude/skills/core/x/SKILL.md",
|
|
2042
|
+
claimed_sha="a" * 64,
|
|
2043
|
+
spawn_ts="2026-04-20T12:00:00Z",
|
|
2044
|
+
)
|
|
2045
|
+
self._assert_schema_baseline(e, "skill_reference_never_read")
|
|
2046
|
+
|
|
2047
|
+
# PLAN-017 Phase 4 (Session 51) — swarm events coverage
|
|
2048
|
+
def test_emit_swarm_started_basic(self):
|
|
2049
|
+
e = self._emit_and_read(
|
|
2050
|
+
"swarm_started", swarm_id="sw-1", n_loops=4, budget_tokens=10000,
|
|
2051
|
+
)
|
|
2052
|
+
self._assert_schema_baseline(e, "swarm_started")
|
|
2053
|
+
|
|
2054
|
+
def test_emit_swarm_iteration_basic(self):
|
|
2055
|
+
e = self._emit_and_read(
|
|
2056
|
+
"swarm_iteration", swarm_id="sw-1", loop_id="L-1", iteration=3,
|
|
2057
|
+
)
|
|
2058
|
+
self._assert_schema_baseline(e, "swarm_iteration")
|
|
2059
|
+
|
|
2060
|
+
def test_emit_swarm_halted_budget_basic(self):
|
|
2061
|
+
e = self._emit_and_read(
|
|
2062
|
+
"swarm_halted_budget", swarm_id="sw-1", tokens_consumed=10500,
|
|
2063
|
+
)
|
|
2064
|
+
self._assert_schema_baseline(e, "swarm_halted_budget")
|
|
2065
|
+
|
|
2066
|
+
def test_emit_swarm_halted_convergence_basic(self):
|
|
2067
|
+
e = self._emit_and_read(
|
|
2068
|
+
"swarm_halted_convergence", swarm_id="sw-1", jaccard=0.92,
|
|
2069
|
+
)
|
|
2070
|
+
self._assert_schema_baseline(e, "swarm_halted_convergence")
|
|
2071
|
+
|
|
2072
|
+
def test_emit_swarm_halted_kill_basic(self):
|
|
2073
|
+
e = self._emit_and_read(
|
|
2074
|
+
"swarm_halted_kill", swarm_id="sw-1", source="env",
|
|
2075
|
+
)
|
|
2076
|
+
self._assert_schema_baseline(e, "swarm_halted_kill")
|
|
2077
|
+
|
|
2078
|
+
def test_emit_swarm_aborted_error_basic(self):
|
|
2079
|
+
e = self._emit_and_read(
|
|
2080
|
+
"swarm_aborted_error", swarm_id="sw-1", error="disk_full",
|
|
2081
|
+
)
|
|
2082
|
+
self._assert_schema_baseline(e, "swarm_aborted_error")
|
|
2083
|
+
|
|
2084
|
+
def test_emit_swarm_killed_basic(self):
|
|
2085
|
+
e = self._emit_and_read(
|
|
2086
|
+
"swarm_killed", swarm_id="sw-1", layer=3,
|
|
2087
|
+
)
|
|
2088
|
+
self._assert_schema_baseline(e, "swarm_killed")
|
|
2089
|
+
|
|
2090
|
+
def test_emit_swarm_tournament_selected_basic(self):
|
|
2091
|
+
e = self._emit_and_read(
|
|
2092
|
+
"swarm_tournament_selected", swarm_id="sw-1", winner_loop="L-2",
|
|
2093
|
+
)
|
|
2094
|
+
self._assert_schema_baseline(e, "swarm_tournament_selected")
|
|
2095
|
+
|
|
2096
|
+
def test_emit_swarm_finalize_grouped_basic(self):
|
|
2097
|
+
e = self._emit_and_read(
|
|
2098
|
+
"swarm_finalize_grouped", swarm_id="sw-1", groups=3,
|
|
2099
|
+
)
|
|
2100
|
+
self._assert_schema_baseline(e, "swarm_finalize_grouped")
|
|
2101
|
+
|
|
2102
|
+
def test_emit_swarm_finalize_committed_basic(self):
|
|
2103
|
+
e = self._emit_and_read(
|
|
2104
|
+
"swarm_finalize_committed", swarm_id="sw-1", commit="abc123",
|
|
2105
|
+
)
|
|
2106
|
+
self._assert_schema_baseline(e, "swarm_finalize_committed")
|
|
2107
|
+
|
|
2108
|
+
# PLAN-048 Phase 2 (Session 51) — CEO escalation events coverage
|
|
2109
|
+
def test_emit_escalation_detected_basic(self):
|
|
2110
|
+
e = self._emit_and_read(
|
|
2111
|
+
"escalation_detected", signal="spawn_count_gap", severity="high",
|
|
2112
|
+
)
|
|
2113
|
+
self._assert_schema_baseline(e, "escalation_detected")
|
|
2114
|
+
|
|
2115
|
+
def test_emit_escalation_dispatched_basic(self):
|
|
2116
|
+
e = self._emit_and_read(
|
|
2117
|
+
"escalation_dispatched", from_model="sonnet-4-6", to_model="opus-4-7",
|
|
2118
|
+
)
|
|
2119
|
+
self._assert_schema_baseline(e, "escalation_dispatched")
|
|
2120
|
+
|
|
2121
|
+
def test_emit_escalation_suppressed_basic(self):
|
|
2122
|
+
e = self._emit_and_read(
|
|
2123
|
+
"escalation_suppressed", reason="cooldown_active",
|
|
2124
|
+
)
|
|
2125
|
+
self._assert_schema_baseline(e, "escalation_suppressed")
|
|
2126
|
+
|
|
2127
|
+
def test_emit_escalation_baseline_recorded_basic(self):
|
|
2128
|
+
e = self._emit_and_read(
|
|
2129
|
+
"escalation_baseline_recorded", session_tag="L2-routine", spawn_count=0,
|
|
2130
|
+
)
|
|
2131
|
+
self._assert_schema_baseline(e, "escalation_baseline_recorded")
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
# ---------------------------------------------------------------------
|
|
2135
|
+
# PLAN-059 SEC-P0-04 / ADR-080 — audit-tokens content-ban emitters
|
|
2136
|
+
# (Session 62 cont, 2026-04-25)
|
|
2137
|
+
# ---------------------------------------------------------------------
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
class TestSecP004AuditTokensEmitters(_EmitterTestBase):
|
|
2141
|
+
"""audit_tokens_* emitters per SEC-P0-04 spec + ADR-080 acceptance."""
|
|
2142
|
+
|
|
2143
|
+
def test_emit_audit_tokens_emitted_basic(self):
|
|
2144
|
+
audit_emit.emit_audit_tokens_emitted(
|
|
2145
|
+
session_id="s-at-001",
|
|
2146
|
+
window_seconds=60,
|
|
2147
|
+
events_scanned=5,
|
|
2148
|
+
tokens_in_total=1000,
|
|
2149
|
+
tokens_out_total=500,
|
|
2150
|
+
cost_cents=2,
|
|
2151
|
+
tier_id_distribution={"opus-4-7": 3, "sonnet-4-6": 2},
|
|
2152
|
+
detector_findings_count={"retry_churn": 1},
|
|
2153
|
+
hook_duration_ms=15,
|
|
2154
|
+
project="/t",
|
|
2155
|
+
)
|
|
2156
|
+
e = self._read_one()
|
|
2157
|
+
self._assert_schema_baseline(e, "audit_tokens_emitted")
|
|
2158
|
+
self.assertEqual(e["session_id"], "s-at-001")
|
|
2159
|
+
self.assertEqual(e["window_seconds"], 60)
|
|
2160
|
+
self.assertEqual(e["events_scanned"], 5)
|
|
2161
|
+
self.assertEqual(e["tokens_in_total"], 1000)
|
|
2162
|
+
self.assertEqual(e["tokens_out_total"], 500)
|
|
2163
|
+
self.assertEqual(e["cost_cents"], 2)
|
|
2164
|
+
|
|
2165
|
+
def test_emit_audit_tokens_timeout_basic(self):
|
|
2166
|
+
audit_emit.emit_audit_tokens_timeout(
|
|
2167
|
+
session_id="s-at-002",
|
|
2168
|
+
timeout_seconds=0.05,
|
|
2169
|
+
project="/t",
|
|
2170
|
+
)
|
|
2171
|
+
e = self._read_one()
|
|
2172
|
+
self._assert_schema_baseline(e, "audit_tokens_timeout")
|
|
2173
|
+
self.assertEqual(e["session_id"], "s-at-002")
|
|
2174
|
+
# timeout_ms: int milliseconds (0.05s → 50ms). No float field.
|
|
2175
|
+
self.assertEqual(e["timeout_ms"], 50)
|
|
2176
|
+
self.assertNotIn("timeout_seconds", e, "old float field must not appear")
|
|
2177
|
+
|
|
2178
|
+
def test_emit_audit_tokens_key_dropped_basic(self):
|
|
2179
|
+
audit_emit.emit_audit_tokens_key_dropped(
|
|
2180
|
+
session_id="s-at-003",
|
|
2181
|
+
dropped_keys=["prompt_excerpt", "stack_trace"],
|
|
2182
|
+
project="/t",
|
|
2183
|
+
)
|
|
2184
|
+
e = self._read_one()
|
|
2185
|
+
self._assert_schema_baseline(e, "audit_tokens_key_dropped")
|
|
2186
|
+
self.assertEqual(e["session_id"], "s-at-003")
|
|
2187
|
+
self.assertEqual(set(e["dropped_keys"]),
|
|
2188
|
+
{"prompt_excerpt", "stack_trace"})
|
|
2189
|
+
self.assertEqual(e["dropped_count"], 2)
|
|
2190
|
+
|
|
2191
|
+
def test_emit_mcp_injection_finding_basic(self):
|
|
2192
|
+
"""PLAN-044 audit-v2 Wave B C1-P0-03 — emit_mcp_injection_finding wired."""
|
|
2193
|
+
audit_emit.emit_mcp_injection_finding(
|
|
2194
|
+
session_id="s-mcp-001",
|
|
2195
|
+
server_id="claude_ai_Stripe",
|
|
2196
|
+
mcp_tool_name="search_payments",
|
|
2197
|
+
source_kind="tool_result",
|
|
2198
|
+
family_counts={"harness_mimicry": 1, "directive_prose": 2},
|
|
2199
|
+
match_count=3,
|
|
2200
|
+
bytes_scanned=4096,
|
|
2201
|
+
severity="warn",
|
|
2202
|
+
snippet_preview="<system-reminder>injected text</system-reminder>",
|
|
2203
|
+
scanner_action="advisory",
|
|
2204
|
+
project="/t",
|
|
2205
|
+
)
|
|
2206
|
+
e = self._read_one()
|
|
2207
|
+
self._assert_schema_baseline(e, "mcp_injection_finding")
|
|
2208
|
+
self.assertEqual(e["session_id"], "s-mcp-001")
|
|
2209
|
+
self.assertEqual(e["server_id"], "claude_ai_Stripe")
|
|
2210
|
+
self.assertEqual(e["mcp_tool_name"], "search_payments")
|
|
2211
|
+
self.assertEqual(e["source_kind"], "tool_result")
|
|
2212
|
+
self.assertEqual(e["match_count"], 3)
|
|
2213
|
+
self.assertEqual(e["bytes_scanned"], 4096)
|
|
2214
|
+
self.assertEqual(e["severity"], "warn")
|
|
2215
|
+
self.assertEqual(e["scanner_action"], "advisory")
|
|
2216
|
+
self.assertEqual(
|
|
2217
|
+
e["family_counts"], {"harness_mimicry": 1, "directive_prose": 2}
|
|
2218
|
+
)
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
class TestSession76SkillBootstrapEmitters(_EmitterTestBase):
|
|
2222
|
+
"""Session 76 audit-v3 / Codex DIM-04 #1 — skill bootstrap registration.
|
|
2223
|
+
|
|
2224
|
+
Pre-Session-76 these actions were emitted via `emit_generic` from
|
|
2225
|
+
`check_skill_patch_sentinel` (skill_bootstrap_used) and
|
|
2226
|
+
`check_skill_bootstrap_post` (skill_bootstrap_post_hash) yet dropped
|
|
2227
|
+
silently by `_write_event` because they were absent from
|
|
2228
|
+
`_KNOWN_ACTIONS`. SPEC v2.15 row + emit registration land in the
|
|
2229
|
+
same audit-v3 ceremony.
|
|
2230
|
+
"""
|
|
2231
|
+
|
|
2232
|
+
def test_emit_skill_bootstrap_used_basic(self):
|
|
2233
|
+
audit_emit.emit_generic(
|
|
2234
|
+
action="skill_bootstrap_used",
|
|
2235
|
+
skill_slug="test-bootstrap-skill",
|
|
2236
|
+
env_set=True,
|
|
2237
|
+
project="/t",
|
|
2238
|
+
)
|
|
2239
|
+
e = self._read_one()
|
|
2240
|
+
# Note: skill_bootstrap_* actions intentionally omit `session_id`
|
|
2241
|
+
# because the production callers (check_skill_patch_sentinel and
|
|
2242
|
+
# check_skill_bootstrap_post) operate during the file-write hook
|
|
2243
|
+
# path where the harness does not pass a session id. SPEC v2.15
|
|
2244
|
+
# documents the required-field list explicitly without session_id.
|
|
2245
|
+
self.assertEqual(e["action"], "skill_bootstrap_used")
|
|
2246
|
+
self.assertEqual(e["event_schema"], "v2")
|
|
2247
|
+
self.assertIn("ts", e)
|
|
2248
|
+
self.assertEqual(e["skill_slug"], "test-bootstrap-skill")
|
|
2249
|
+
self.assertTrue(e["env_set"])
|
|
2250
|
+
|
|
2251
|
+
def test_emit_skill_bootstrap_post_hash_basic(self):
|
|
2252
|
+
audit_emit.emit_generic(
|
|
2253
|
+
action="skill_bootstrap_post_hash",
|
|
2254
|
+
skill_slug="test-bootstrap-skill",
|
|
2255
|
+
sha256="0" * 64,
|
|
2256
|
+
file_size=2048,
|
|
2257
|
+
bootstrap_event_correlated=True,
|
|
2258
|
+
bootstrap_ts_s=1700000000,
|
|
2259
|
+
suspicious_delay_ms=-1,
|
|
2260
|
+
anomaly=False,
|
|
2261
|
+
hook_version="1.0.0",
|
|
2262
|
+
project="/t",
|
|
2263
|
+
)
|
|
2264
|
+
e = self._read_one()
|
|
2265
|
+
# See note in test_emit_skill_bootstrap_used_basic above re session_id.
|
|
2266
|
+
self.assertEqual(e["action"], "skill_bootstrap_post_hash")
|
|
2267
|
+
self.assertEqual(e["event_schema"], "v2")
|
|
2268
|
+
self.assertIn("ts", e)
|
|
2269
|
+
self.assertEqual(e["skill_slug"], "test-bootstrap-skill")
|
|
2270
|
+
self.assertEqual(e["sha256"], "0" * 64)
|
|
2271
|
+
self.assertEqual(e["file_size"], 2048)
|
|
2272
|
+
self.assertTrue(e["bootstrap_event_correlated"])
|
|
2273
|
+
self.assertFalse(e["anomaly"])
|
|
2274
|
+
# Int fields — no float in HMAC-covered payload.
|
|
2275
|
+
self.assertEqual(e["bootstrap_ts_s"], 1700000000)
|
|
2276
|
+
self.assertEqual(e["suspicious_delay_ms"], -1)
|
|
2277
|
+
self.assertNotIn("bootstrap_ts", e, "old float field must not appear")
|
|
2278
|
+
self.assertNotIn("suspicious_delay_s", e, "old float field must not appear")
|
|
2279
|
+
|
|
2280
|
+
|
|
2281
|
+
class TestPlan075PairRailEmitters(_EmitterTestBase):
|
|
2282
|
+
"""PLAN-075 v1.13.x patch (S96-cont-2 ceremony 2026-05-09) / ADR-106 + ADR-110.
|
|
2283
|
+
|
|
2284
|
+
Pair-Rail Multi-LLM cross-review hook events. Wired by
|
|
2285
|
+
check_pair_rail.py PreToolUse on Edit|Write|MultiEdit against L3+
|
|
2286
|
+
canonical-guarded paths. SPEC v2.22 introduces 4 actions registered
|
|
2287
|
+
with KERNEL_OVERRIDE bypass since audit_emit.py is in _KERNEL_PATHS.
|
|
2288
|
+
"""
|
|
2289
|
+
|
|
2290
|
+
def test_emit_pair_rail_review_passed_basic(self):
|
|
2291
|
+
audit_emit.emit_pair_rail_review_passed(
|
|
2292
|
+
target_path=".claude/hooks/_lib/audit_emit.py",
|
|
2293
|
+
tool_name="Edit",
|
|
2294
|
+
codex_duration_ms=1234,
|
|
2295
|
+
codex_response_sha256="a" * 64,
|
|
2296
|
+
session_id="s-pr-pass",
|
|
2297
|
+
project="/t",
|
|
2298
|
+
)
|
|
2299
|
+
e = self._read_one()
|
|
2300
|
+
self._assert_schema_baseline(e, "pair_rail_review_passed")
|
|
2301
|
+
self.assertEqual(e["session_id"], "s-pr-pass")
|
|
2302
|
+
self.assertEqual(e["target_path"], ".claude/hooks/_lib/audit_emit.py")
|
|
2303
|
+
self.assertEqual(e["tool_name"], "Edit")
|
|
2304
|
+
self.assertEqual(e["codex_duration_ms"], 1234)
|
|
2305
|
+
self.assertEqual(e["codex_response_sha256"], "a" * 64)
|
|
2306
|
+
|
|
2307
|
+
def test_emit_pair_rail_codex_unavailable_basic(self):
|
|
2308
|
+
audit_emit.emit_pair_rail_codex_unavailable(
|
|
2309
|
+
target_path=".claude/hooks/check_canonical_edit.py",
|
|
2310
|
+
tool_name="Write",
|
|
2311
|
+
reason="connect_timeout",
|
|
2312
|
+
session_id="s-pr-unavail",
|
|
2313
|
+
project="/t",
|
|
2314
|
+
)
|
|
2315
|
+
e = self._read_one()
|
|
2316
|
+
self._assert_schema_baseline(e, "pair_rail_codex_unavailable")
|
|
2317
|
+
self.assertEqual(e["session_id"], "s-pr-unavail")
|
|
2318
|
+
self.assertEqual(e["tool_name"], "Write")
|
|
2319
|
+
self.assertEqual(e["reason"], "connect_timeout")
|
|
2320
|
+
|
|
2321
|
+
def test_emit_pair_rail_codex_violation_basic(self):
|
|
2322
|
+
audit_emit.emit_pair_rail_codex_violation(
|
|
2323
|
+
target_path="SPEC/v1/audit-log.schema.md",
|
|
2324
|
+
tool_name="MultiEdit",
|
|
2325
|
+
violation_type="unified_diff_detected",
|
|
2326
|
+
codex_response_sha256="b" * 64,
|
|
2327
|
+
session_id="s-pr-violation",
|
|
2328
|
+
project="/t",
|
|
2329
|
+
)
|
|
2330
|
+
e = self._read_one()
|
|
2331
|
+
self._assert_schema_baseline(e, "pair_rail_codex_violation")
|
|
2332
|
+
self.assertEqual(e["session_id"], "s-pr-violation")
|
|
2333
|
+
self.assertEqual(e["tool_name"], "MultiEdit")
|
|
2334
|
+
self.assertEqual(e["violation_type"], "unified_diff_detected")
|
|
2335
|
+
self.assertEqual(e["codex_response_sha256"], "b" * 64)
|
|
2336
|
+
|
|
2337
|
+
def test_emit_pair_rail_sentinel_bypass_basic(self):
|
|
2338
|
+
audit_emit.emit_pair_rail_sentinel_bypass(
|
|
2339
|
+
target_path=".claude/hooks/check_pair_rail.py",
|
|
2340
|
+
tool_name="Edit",
|
|
2341
|
+
sentinel_path=".claude/plans/PLAN-075/architect/round-v1.13.x-patch/approved.md",
|
|
2342
|
+
session_id="s-pr-bypass",
|
|
2343
|
+
project="/t",
|
|
2344
|
+
)
|
|
2345
|
+
e = self._read_one()
|
|
2346
|
+
self._assert_schema_baseline(e, "pair_rail_sentinel_bypass")
|
|
2347
|
+
self.assertEqual(e["session_id"], "s-pr-bypass")
|
|
2348
|
+
self.assertEqual(e["tool_name"], "Edit")
|
|
2349
|
+
self.assertEqual(
|
|
2350
|
+
e["sentinel_path"],
|
|
2351
|
+
".claude/plans/PLAN-075/architect/round-v1.13.x-patch/approved.md",
|
|
2352
|
+
)
|
|
2353
|
+
|
|
2354
|
+
def test_emit_pair_rail_codex_injection_detected_basic(self):
|
|
2355
|
+
"""PLAN-081 Phase 1-full / R1 S-Sec-5 — Codex ingress sanitization emit."""
|
|
2356
|
+
audit_emit.emit_pair_rail_codex_injection_detected(
|
|
2357
|
+
tool_name="mcp__codex__codex",
|
|
2358
|
+
family_ids=["harness_mimicry", "xml_system_tag"],
|
|
2359
|
+
match_count=3,
|
|
2360
|
+
first_offset_bucket="1k-10k",
|
|
2361
|
+
session_id="s-codex-injection",
|
|
2362
|
+
project="/t",
|
|
2363
|
+
)
|
|
2364
|
+
e = self._read_one()
|
|
2365
|
+
self._assert_schema_baseline(e, "pair_rail_codex_injection_detected")
|
|
2366
|
+
self.assertEqual(e["session_id"], "s-codex-injection")
|
|
2367
|
+
self.assertEqual(e["tool_name"], "mcp__codex__codex")
|
|
2368
|
+
self.assertEqual(
|
|
2369
|
+
sorted(e["family_ids"]),
|
|
2370
|
+
["harness_mimicry", "xml_system_tag"],
|
|
2371
|
+
)
|
|
2372
|
+
self.assertEqual(e["match_count"], 3)
|
|
2373
|
+
self.assertEqual(e["first_offset_bucket"], "1k-10k")
|
|
2374
|
+
|
|
2375
|
+
def test_emit_pair_rail_codex_injection_detected_unknown_family_dropped(self):
|
|
2376
|
+
"""Unknown family_ids must be dropped (Sec MF-3 invariant)."""
|
|
2377
|
+
audit_emit.emit_pair_rail_codex_injection_detected(
|
|
2378
|
+
tool_name="mcp__codex__codex-reply",
|
|
2379
|
+
family_ids=["harness_mimicry", "FAKE_INJECTION_FAMILY"],
|
|
2380
|
+
match_count=1,
|
|
2381
|
+
first_offset_bucket="0-100",
|
|
2382
|
+
session_id="s-bad-family",
|
|
2383
|
+
project="/t",
|
|
2384
|
+
)
|
|
2385
|
+
e = self._read_one()
|
|
2386
|
+
self.assertEqual(e["family_ids"], ["harness_mimicry"])
|
|
2387
|
+
|
|
2388
|
+
def test_emit_pair_rail_codex_injection_detected_invalid_bucket_coerces(self):
|
|
2389
|
+
"""Invalid first_offset_bucket coerces to safe default '0-100'."""
|
|
2390
|
+
audit_emit.emit_pair_rail_codex_injection_detected(
|
|
2391
|
+
tool_name="mcp__codex__codex",
|
|
2392
|
+
family_ids=["tool_use_forgery"],
|
|
2393
|
+
match_count=2,
|
|
2394
|
+
first_offset_bucket="bogus-bucket",
|
|
2395
|
+
session_id="s-bad-bucket",
|
|
2396
|
+
project="/t",
|
|
2397
|
+
)
|
|
2398
|
+
e = self._read_one()
|
|
2399
|
+
self.assertEqual(e["first_offset_bucket"], "0-100")
|
|
2400
|
+
|
|
2401
|
+
# ---- PLAN-081 Phase 2 (S100 ceremony 2026-05-10) ------------------------
|
|
2402
|
+
|
|
2403
|
+
def test_emit_dispatcher_route_basic(self):
|
|
2404
|
+
"""PLAN-081 Phase 2 — dispatcher routing-matrix decision emit."""
|
|
2405
|
+
audit_emit.emit_dispatcher_route(
|
|
2406
|
+
archetype="code-reviewer",
|
|
2407
|
+
rail="pair_rail",
|
|
2408
|
+
reason_code="ok",
|
|
2409
|
+
matrix_sha256_prefix="0bf963f6685a4584",
|
|
2410
|
+
matrix_sha256_match=True,
|
|
2411
|
+
coder="claude",
|
|
2412
|
+
reviewer="codex",
|
|
2413
|
+
coder_model="opus",
|
|
2414
|
+
reviewer_sandbox="read-only",
|
|
2415
|
+
fallback_provider="claude",
|
|
2416
|
+
wall_clock_ms=42,
|
|
2417
|
+
session_id="s-dispatcher",
|
|
2418
|
+
project="/t",
|
|
2419
|
+
)
|
|
2420
|
+
e = self._read_one()
|
|
2421
|
+
self._assert_schema_baseline(e, "dispatcher_route")
|
|
2422
|
+
self.assertEqual(e["archetype"], "code-reviewer")
|
|
2423
|
+
self.assertEqual(e["rail"], "pair_rail")
|
|
2424
|
+
self.assertEqual(e["coder"], "claude")
|
|
2425
|
+
self.assertEqual(e["reviewer"], "codex")
|
|
2426
|
+
self.assertEqual(e["wall_clock_ms"], 42)
|
|
2427
|
+
self.assertTrue(e["matrix_sha256_match"])
|
|
2428
|
+
|
|
2429
|
+
def test_emit_dispatcher_route_invalid_rail_coerces(self):
|
|
2430
|
+
"""Unknown rail value coerces to safe fallback_claude_only."""
|
|
2431
|
+
audit_emit.emit_dispatcher_route(
|
|
2432
|
+
archetype="qa-architect",
|
|
2433
|
+
rail="bogus_rail_value",
|
|
2434
|
+
reason_code="test_invalid",
|
|
2435
|
+
matrix_sha256_prefix="",
|
|
2436
|
+
matrix_sha256_match=False,
|
|
2437
|
+
coder="claude",
|
|
2438
|
+
reviewer="codex",
|
|
2439
|
+
session_id="s-bad-rail",
|
|
2440
|
+
project="/t",
|
|
2441
|
+
)
|
|
2442
|
+
e = self._read_one()
|
|
2443
|
+
self.assertEqual(e["rail"], "fallback_claude_only")
|
|
2444
|
+
|
|
2445
|
+
def test_emit_dispatcher_route_forbidden_field_dropped(self):
|
|
2446
|
+
"""Dispatch-gate scrub drops forbidden fields (Sec MF-3 invariant)."""
|
|
2447
|
+
audit_emit.emit_generic(
|
|
2448
|
+
"dispatcher_route",
|
|
2449
|
+
archetype="docs-writer",
|
|
2450
|
+
rail="pair_rail",
|
|
2451
|
+
reason_code="ok",
|
|
2452
|
+
matrix_sha256_prefix="abc123def4567890",
|
|
2453
|
+
matrix_sha256_match=False,
|
|
2454
|
+
coder="claude",
|
|
2455
|
+
reviewer="codex",
|
|
2456
|
+
wall_clock_ms=10,
|
|
2457
|
+
# Forbidden fields — must be scrubbed:
|
|
2458
|
+
task_description="this should be dropped",
|
|
2459
|
+
skill_content="this too",
|
|
2460
|
+
session_id="s-scrub",
|
|
2461
|
+
project="/t",
|
|
2462
|
+
)
|
|
2463
|
+
e = self._read_one()
|
|
2464
|
+
self.assertNotIn("task_description", e)
|
|
2465
|
+
self.assertNotIn("skill_content", e)
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
def test_emit_pair_rail_case_basic(self):
|
|
2469
|
+
"""PLAN-081 Phase 3 - asymmetric VETO matrix Cases A-F emit."""
|
|
2470
|
+
audit_emit.emit_pair_rail_case(
|
|
2471
|
+
case="A",
|
|
2472
|
+
claude_verdict="PASS",
|
|
2473
|
+
codex_verdict="PASS",
|
|
2474
|
+
tool_name="Edit",
|
|
2475
|
+
file_path_hash_prefix="abc123def4567890",
|
|
2476
|
+
precondition_met=False,
|
|
2477
|
+
rubric_violation_id="",
|
|
2478
|
+
severity="",
|
|
2479
|
+
jaccard_similarity_bucket=">0.8",
|
|
2480
|
+
human_triage_grace_h=0,
|
|
2481
|
+
session_id="s-pair-rail-case",
|
|
2482
|
+
project="/t",
|
|
2483
|
+
)
|
|
2484
|
+
e = self._read_one()
|
|
2485
|
+
self._assert_schema_baseline(e, "pair_rail_case")
|
|
2486
|
+
self.assertEqual(e["case"], "A")
|
|
2487
|
+
self.assertEqual(e["claude_verdict"], "PASS")
|
|
2488
|
+
self.assertEqual(e["codex_verdict"], "PASS")
|
|
2489
|
+
self.assertEqual(e["tool_name"], "Edit")
|
|
2490
|
+
|
|
2491
|
+
def test_emit_pair_rail_case_invalid_case_coerces(self):
|
|
2492
|
+
"""Invalid case value coerces to safe default 'F'."""
|
|
2493
|
+
audit_emit.emit_pair_rail_case(
|
|
2494
|
+
case="Z",
|
|
2495
|
+
claude_verdict="PASS",
|
|
2496
|
+
codex_verdict="PASS",
|
|
2497
|
+
tool_name="Edit",
|
|
2498
|
+
file_path_hash_prefix="abc",
|
|
2499
|
+
session_id="s-bad-case",
|
|
2500
|
+
project="/t",
|
|
2501
|
+
)
|
|
2502
|
+
e = self._read_one()
|
|
2503
|
+
self.assertEqual(e["case"], "F")
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
def test_emit_pair_rail_promotion_basic(self):
|
|
2507
|
+
"""PLAN-081 Phase 4 - promotion gate verdict emit."""
|
|
2508
|
+
audit_emit.emit_pair_rail_promotion(
|
|
2509
|
+
run_id="abc12345-test-run",
|
|
2510
|
+
verdict="PASS",
|
|
2511
|
+
corpus_n=15,
|
|
2512
|
+
corpus_manifest_sha="0123456789abcdef",
|
|
2513
|
+
catch_rate_num=15,
|
|
2514
|
+
catch_rate_den=15,
|
|
2515
|
+
fp_rate_bucket="<=15%",
|
|
2516
|
+
schema_adherence_pct_bucket="100%",
|
|
2517
|
+
rubric_gap_pp_bucket="<=0pp",
|
|
2518
|
+
codex_cli_version="0.128.5",
|
|
2519
|
+
python_version="3.9.6",
|
|
2520
|
+
git_head_sha_prefix="1e358e3abc",
|
|
2521
|
+
pass_2_retry_used=False,
|
|
2522
|
+
manual_triage=False,
|
|
2523
|
+
session_id="s-promotion-pass",
|
|
2524
|
+
project="/t",
|
|
2525
|
+
)
|
|
2526
|
+
e = self._read_one()
|
|
2527
|
+
self._assert_schema_baseline(e, "pair_rail_promotion")
|
|
2528
|
+
self.assertEqual(e["verdict"], "PASS")
|
|
2529
|
+
self.assertEqual(e["corpus_n"], 15)
|
|
2530
|
+
self.assertEqual(e["catch_rate_num"], 15)
|
|
2531
|
+
|
|
2532
|
+
def test_emit_pair_rail_promotion_invalid_verdict_coerces(self):
|
|
2533
|
+
"""Unknown verdict coerces to safe FAIL."""
|
|
2534
|
+
audit_emit.emit_pair_rail_promotion(
|
|
2535
|
+
run_id="bad-verdict-run",
|
|
2536
|
+
verdict="UNKNOWN_VERDICT",
|
|
2537
|
+
corpus_n=10,
|
|
2538
|
+
corpus_manifest_sha="",
|
|
2539
|
+
catch_rate_num=5,
|
|
2540
|
+
catch_rate_den=10,
|
|
2541
|
+
session_id="s-bad-verdict",
|
|
2542
|
+
project="/t",
|
|
2543
|
+
)
|
|
2544
|
+
e = self._read_one()
|
|
2545
|
+
self.assertEqual(e["verdict"], "FAIL")
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
class TestPlan083NewActions(unittest.TestCase):
|
|
2550
|
+
"""PLAN-083 Wave 0a/0b/1+2 (S106 ceremony 2026-05-11) — smoke tests for the 10 new audit actions registered atomically per S100 L6 lesson. Per-action presence in _KNOWN_ACTIONS verified."""
|
|
2551
|
+
def test_emit_token_budget_guard_paused_basic(self):
|
|
2552
|
+
"""PLAN-083 Wave 0b sub-agent 0.4 (S106) — token_budget_guard_paused registered."""
|
|
2553
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2554
|
+
self.assertIn("token_budget_guard_paused", _KNOWN_ACTIONS)
|
|
2555
|
+
|
|
2556
|
+
def test_emit_anti_ceo_overhead_block_basic(self):
|
|
2557
|
+
"""PLAN-083 Wave 0b sub-agent 0.5 (S106) — anti_ceo_overhead_block registered."""
|
|
2558
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2559
|
+
self.assertIn("anti_ceo_overhead_block", _KNOWN_ACTIONS)
|
|
2560
|
+
|
|
2561
|
+
def test_emit_anti_ceo_overhead_override_used_basic(self):
|
|
2562
|
+
"""PLAN-083 Wave 0b sub-agent 0.5 (S106) — anti_ceo_overhead_override_used registered."""
|
|
2563
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2564
|
+
self.assertIn("anti_ceo_overhead_override_used", _KNOWN_ACTIONS)
|
|
2565
|
+
|
|
2566
|
+
def test_emit_smart_loading_resolved_basic(self):
|
|
2567
|
+
"""PLAN-083 Wave 0b sub-agent 0.7d (S106) — smart_loading_resolved registered."""
|
|
2568
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2569
|
+
self.assertIn("smart_loading_resolved", _KNOWN_ACTIONS)
|
|
2570
|
+
|
|
2571
|
+
def test_emit_first_run_wizard_completed_basic(self):
|
|
2572
|
+
"""PLAN-083 Wave 2 sub-agent 2.1 — first_run_wizard_completed registered."""
|
|
2573
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2574
|
+
self.assertIn("first_run_wizard_completed", _KNOWN_ACTIONS)
|
|
2575
|
+
|
|
2576
|
+
def test_emit_contextual_recommendation_emitted_basic(self):
|
|
2577
|
+
"""PLAN-083 Wave 2 sub-agent 2.2 — contextual_recommendation_emitted registered."""
|
|
2578
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2579
|
+
self.assertIn("contextual_recommendation_emitted", _KNOWN_ACTIONS)
|
|
2580
|
+
|
|
2581
|
+
def test_emit_value_dashboard_summarized_basic(self):
|
|
2582
|
+
"""PLAN-083 Wave 2 sub-agent 2.4 — value_dashboard_summarized registered."""
|
|
2583
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2584
|
+
self.assertIn("value_dashboard_summarized", _KNOWN_ACTIONS)
|
|
2585
|
+
|
|
2586
|
+
def test_emit_trading_write_override_used_basic(self):
|
|
2587
|
+
"""PLAN-083 Wave 2 sub-agent 2.7 — trading_write_override_used registered."""
|
|
2588
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2589
|
+
self.assertIn("trading_write_override_used", _KNOWN_ACTIONS)
|
|
2590
|
+
|
|
2591
|
+
def test_emit_trading_kill_switch_invoked_basic(self):
|
|
2592
|
+
"""PLAN-083 Wave 2 sub-agent 2.7 — trading_kill_switch_invoked registered."""
|
|
2593
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2594
|
+
self.assertIn("trading_kill_switch_invoked", _KNOWN_ACTIONS)
|
|
2595
|
+
|
|
2596
|
+
def test_emit_trading_kill_switch_disabled_basic(self):
|
|
2597
|
+
"""PLAN-083 Wave 2 sub-agent 2.7 — trading_kill_switch_disabled registered."""
|
|
2598
|
+
from _lib.audit_emit import _KNOWN_ACTIONS
|
|
2599
|
+
self.assertIn("trading_kill_switch_disabled", _KNOWN_ACTIONS)
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
class TestPlan120FollowupCoverageBackfill(_EmitterTestBase):
|
|
2603
|
+
"""PLAN-120-FOLLOWUP E3-F11 — representative coverage backfill.
|
|
2604
|
+
|
|
2605
|
+
Two emitters that were in the EmitterCoverageGate gap (neither in
|
|
2606
|
+
_DEFERRED_COVERAGE) now get real emit + schema-baseline tests. The
|
|
2607
|
+
remaining 72-action long-tail is enumerated in
|
|
2608
|
+
PLAN-120-FOLLOWUP/receipts/bscope-disposition.md §5 for the dedicated
|
|
2609
|
+
coverage-completion plan (S169 B-scope Batch B2).
|
|
2610
|
+
"""
|
|
2611
|
+
|
|
2612
|
+
def test_emit_claim_emitted_basic(self):
|
|
2613
|
+
audit_emit.emit_claim_emitted(
|
|
2614
|
+
claim_id="CLAIM-XYZ",
|
|
2615
|
+
claim_type="perf",
|
|
2616
|
+
severity="warn",
|
|
2617
|
+
verifier_kind="benchmark",
|
|
2618
|
+
payload_hash="abc123def456",
|
|
2619
|
+
kind_supported=True,
|
|
2620
|
+
line_num=42,
|
|
2621
|
+
agent_name="qa-architect",
|
|
2622
|
+
source="check_confidence_gate",
|
|
2623
|
+
session_id="s-claim",
|
|
2624
|
+
project="/t",
|
|
2625
|
+
)
|
|
2626
|
+
e = self._read_one()
|
|
2627
|
+
self._assert_schema_baseline(e, "claim_emitted")
|
|
2628
|
+
self.assertEqual(e["claim_type"], "perf")
|
|
2629
|
+
self.assertEqual(e["severity"], "warn")
|
|
2630
|
+
self.assertTrue(e["kind_supported"])
|
|
2631
|
+
self.assertEqual(e["line_num"], 42)
|
|
2632
|
+
# claim_id is hashed (LLM06 hold) — raw value must NOT leak.
|
|
2633
|
+
self.assertNotEqual(e["claim_id"], "CLAIM-XYZ")
|
|
2634
|
+
|
|
2635
|
+
def test_emit_claim_emitted_invalid_severity_drops_to_info(self):
|
|
2636
|
+
audit_emit.emit_claim_emitted(
|
|
2637
|
+
claim_id="CLAIM-2",
|
|
2638
|
+
claim_type="sec",
|
|
2639
|
+
severity="bogus-not-an-enum",
|
|
2640
|
+
verifier_kind="static",
|
|
2641
|
+
payload_hash="deadbeef",
|
|
2642
|
+
kind_supported=False,
|
|
2643
|
+
)
|
|
2644
|
+
e = self._read_one()
|
|
2645
|
+
self._assert_schema_baseline(e, "claim_emitted")
|
|
2646
|
+
self.assertEqual(e["severity"], "info") # ADR-018 fail-open sentinel
|
|
2647
|
+
|
|
2648
|
+
def test_emit_chain_reset_marker_basic(self):
|
|
2649
|
+
audit_emit.emit_chain_reset_marker(
|
|
2650
|
+
previous_archive_path="audit-log-2026-05-29-pre-fix.jsonl",
|
|
2651
|
+
previous_archive_last_hmac="a" * 64,
|
|
2652
|
+
rotation_ts="2026-05-29T12:00:00Z",
|
|
2653
|
+
rotation_trigger="owner_rotation",
|
|
2654
|
+
session_id="s-rot",
|
|
2655
|
+
project="/t",
|
|
2656
|
+
)
|
|
2657
|
+
e = self._read_one()
|
|
2658
|
+
self._assert_schema_baseline(e, "chain_reset_marker")
|
|
2659
|
+
self.assertEqual(e["rotation_trigger"], "owner_rotation")
|
|
2660
|
+
self.assertEqual(
|
|
2661
|
+
e["previous_archive_path"], "audit-log-2026-05-29-pre-fix.jsonl"
|
|
2662
|
+
)
|
|
2663
|
+
self.assertEqual(e["previous_archive_last_hmac"], "a" * 64)
|
|
2664
|
+
|
|
2665
|
+
def test_emit_chain_reset_marker_invalid_trigger_defaults(self):
|
|
2666
|
+
audit_emit.emit_chain_reset_marker(
|
|
2667
|
+
previous_archive_path="x.jsonl",
|
|
2668
|
+
previous_archive_last_hmac="",
|
|
2669
|
+
rotation_ts="2026-05-29T12:00:00Z",
|
|
2670
|
+
rotation_trigger="not-a-valid-trigger",
|
|
2671
|
+
)
|
|
2672
|
+
e = self._read_one()
|
|
2673
|
+
self._assert_schema_baseline(e, "chain_reset_marker")
|
|
2674
|
+
# fail-open: unknown trigger falls back to the common case.
|
|
2675
|
+
self.assertEqual(e["rotation_trigger"], "size_threshold")
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
if __name__ == "__main__":
|
|
2679
|
+
unittest.main()
|