From fb97d7cfe229303d3dc66f538b7733387da3f3c0 Mon Sep 17 00:00:00 2001
From: Joseph Ibrahim
-
+
@@ -252,7 +252,7 @@ Orchestra/
β βββ test_parameter_locker.py # Safety gating
β βββ test_otel_adapter.py # Observability
β βββ ... # Integration, chaos, resilience
-βββ pyproject.toml # v5.0.1
+βββ pyproject.toml # v5.0.3
```
---
@@ -308,7 +308,7 @@ MIT License - see [LICENSE](LICENSE) for details.
---
-*Orchestra v5.0.1 - Cognitive Engine for Claude Code*
+*Orchestra v5.0.3 - Cognitive Engine for Claude Code*
[](https://pypi.org/project/cognitive-orchestra/)
[](https://opensource.org/licenses/MIT)
diff --git a/THINKINGMACHINES_COMPLIANCE.md b/THINKINGMACHINES_COMPLIANCE.md
index fb9a17a..e4910f2 100644
--- a/THINKINGMACHINES_COMPLIANCE.md
+++ b/THINKINGMACHINES_COMPLIANCE.md
@@ -23,6 +23,32 @@ Orchestra demonstrates **STRONG** batch-invariance compliance with a few minor v
---
+## Scope of Determinism
+
+*Added in v5.0.3.* This section clarifies what Orchestra's "He2025 compliance" claim actually covers β and what it doesn't.
+
+### What IS deterministic
+
+- **Routing decisions** β signal detection (PRISM) β expert selection (MoE) β locked parameters. Given identical state and input, Orchestra produces identical routing every time.
+- **Routing checksum** β the 6-character hex checksum in `LockedParams` is batch-invariant per [He2025]. It excludes `reflection_iteration` by design so the same routing decision yields the same checksum across MAX3 reflection cycles.
+- **Persisted cognitive state** β atomic writes via `file_ops.atomic_write_json()` with `sort_keys=True`. Same state β same on-disk bytes.
+- **Anchor format** β `[EXEC:checksum|expert|paradigm|altitude|depth]` is constructed by a single function (`LockedParams.to_anchor()`) and the field count is contract.
+
+### What IS NOT deterministic
+
+- **Claude's response text.** The Anthropic API does not guarantee bitwise reproducibility, particularly under adaptive thinking (`thinking: {type: "adaptive"}`) which is the only on-mode on Opus 4.7. Tests that assert on exact response strings will be flaky by design.
+- **Wall-clock timestamps** in observability logs.
+- **Compaction outputs** (when context compaction is enabled β beta on Opus 4.7).
+- **Token counts.** Opus 4.7 counts tokens differently from Opus 4.6 for the same input; do not assume `count_tokens()` results are stable across model versions.
+
+### What this means in practice
+
+Orchestra's anchor provides **session continuity and routing reproducibility**, not bit-for-bit output reproducibility. The He2025 batch-invariance claim is about Orchestra's kernel selection (which expert fires, which params get locked), not about what Claude says in response.
+
+If you're building tests that need to compare Claude's output across runs, use Orchestra's checksum for routing identity. Do not assert on response text β use structural or semantic checks instead.
+
+---
+
## Compliance Analysis
### COMPLIANT Components
diff --git a/src/orchestra/__init__.py b/src/orchestra/__init__.py
index 9cf607e..cd53b2c 100644
--- a/src/orchestra/__init__.py
+++ b/src/orchestra/__init__.py
@@ -54,7 +54,7 @@
FO_LOG_LEVEL - DEBUG, INFO, WARNING, ERROR
"""
-__version__ = "5.0.1"
+__version__ = "5.0.3"
__author__ = "Framework Ecosystem Integration"
# Core orchestrator
@@ -356,6 +356,7 @@
LockResult,
ParameterLocker,
DEPTH_BUDGETS,
+ DEPTH_TO_EFFORT,
create_locker,
)
@@ -655,6 +656,7 @@
"LockResult",
"ParameterLocker",
"DEPTH_BUDGETS",
+ "DEPTH_TO_EFFORT",
"create_locker",
# Convergence Tracker (RC^+xi)
diff --git a/src/orchestra/claude_code_hook.py b/src/orchestra/claude_code_hook.py
index 9e8c7fb..cd31011 100644
--- a/src/orchestra/claude_code_hook.py
+++ b/src/orchestra/claude_code_hook.py
@@ -142,15 +142,18 @@ def build_guidance(result: NexusResult) -> str:
trigger = result.routing.trigger
paradigm = result.lock.params.paradigm
- # Expert-specific guidance
+ # Expert-specific guidance.
+ # v5.0.3: softened for Opus 4.7's stricter literal-instruction-following.
+ # All-caps imperatives ("EMPATHY FIRST", "BREAK DOWN", etc.) overtriggered
+ # on 4.7. Conditional phrasing ("when X, do Y") is the recommended pattern.
expert_guidance = {
- "validator": "EMPATHY FIRST. Acknowledge the struggle. Normalize difficulty. Do not immediately try to solve.",
- "scaffolder": "BREAK DOWN the task. Provide structure. Reduce scope if needed. One small step at a time.",
- "restorer": "EASY WINS mode. Suggest simple tasks. Rest is OK. Recovery without guilt.",
- "refocuser": "GENTLE REDIRECT. Acknowledge the tangent, then guide back to the goal.",
- "celebrator": "ACKNOWLEDGE THE WIN. Provide dopamine boost. Celebrate before moving on.",
- "socratic": "GUIDE DISCOVERY. Follow threads. Ask questions. Let them explore.",
- "direct": "MINIMAL FRICTION. Stay out of the way. Direct execution."
+ "validator": "Lead with empathy. Acknowledge the difficulty before suggesting solutions.",
+ "scaffolder": "Break the task into smaller steps. Offer structure when scope is unclear.",
+ "restorer": "Suggest a lighter task or a pause. Recovery is part of the work.",
+ "refocuser": "Acknowledge the tangent briefly, then return to the original goal.",
+ "celebrator": "Acknowledge the win with a short, specific recognition.",
+ "socratic": "Offer questions that help discovery. Follow promising threads.",
+ "direct": "Stay direct. Minimal friction. Execute.",
}
guidance = expert_guidance.get(expert, "Proceed with standard response.")
diff --git a/src/orchestra/parameter_locker.py b/src/orchestra/parameter_locker.py
index 59f45a3..50cf6fb 100644
--- a/src/orchestra/parameter_locker.py
+++ b/src/orchestra/parameter_locker.py
@@ -47,7 +47,8 @@ class ThinkDepth(Enum):
ULTRADEEP = "ultradeep" # 128K tokens (Opus only)
-# Depth budgets
+# Depth budgets (legacy β designed for Opus 4.5/4.6 `thinking.budget_tokens`).
+# Retained for backward compatibility; downstream consumers may still import this.
DEPTH_BUDGETS = {
ThinkDepth.MINIMAL: 1_000,
ThinkDepth.STANDARD: 8_000,
@@ -55,6 +56,18 @@ class ThinkDepth(Enum):
ThinkDepth.ULTRADEEP: 128_000
}
+# Opus 4.7+ vocabulary alignment (added v5.0.3).
+# Maps Orchestra's depth tiers to Anthropic's `output_config.effort` levels.
+# On Opus 4.7, `thinking.budget_tokens` is removed (400 error); `effort` is the
+# correct knob. `xhigh` is new on 4.7 β recommended default for coding/agentic
+# work and used by Claude Code itself.
+DEPTH_TO_EFFORT = {
+ ThinkDepth.MINIMAL: "low",
+ ThinkDepth.STANDARD: "medium",
+ ThinkDepth.DEEP: "high",
+ ThinkDepth.ULTRADEEP: "xhigh",
+}
+
# =============================================================================
# Paradigms
diff --git a/tests/test_parameter_locker.py b/tests/test_parameter_locker.py
index 7b4d198..66c83dd 100644
--- a/tests/test_parameter_locker.py
+++ b/tests/test_parameter_locker.py
@@ -24,6 +24,7 @@
LockResult,
ParameterLocker,
DEPTH_BUDGETS,
+ DEPTH_TO_EFFORT,
create_locker,
)
from orchestra.expert_router import Expert, RoutingResult
@@ -48,6 +49,32 @@ def test_depth_budgets(self):
assert DEPTH_BUDGETS[ThinkDepth.ULTRADEEP] == 128_000
+class TestDepthToEffort:
+ """v5.0.3: Opus 4.7 vocabulary alignment.
+
+ DEPTH_TO_EFFORT maps Orchestra's depth tiers to Anthropic's
+ `output_config.effort` levels. On Opus 4.7, `thinking.budget_tokens`
+ is removed (400 error); `effort` is the correct knob.
+ """
+
+ def test_effort_mapping(self):
+ """Should map each ThinkDepth tier to the correct effort level."""
+ assert DEPTH_TO_EFFORT[ThinkDepth.MINIMAL] == "low"
+ assert DEPTH_TO_EFFORT[ThinkDepth.STANDARD] == "medium"
+ assert DEPTH_TO_EFFORT[ThinkDepth.DEEP] == "high"
+ assert DEPTH_TO_EFFORT[ThinkDepth.ULTRADEEP] == "xhigh"
+
+ def test_legacy_budgets_still_exported(self):
+ """v5.0.3 is an additive change β DEPTH_BUDGETS must stay on public API."""
+ from orchestra import DEPTH_BUDGETS as legacy_budgets
+ assert legacy_budgets[ThinkDepth.STANDARD] == 8_000
+
+ def test_new_mapping_publicly_exported(self):
+ """DEPTH_TO_EFFORT should be importable from orchestra top-level."""
+ from orchestra import DEPTH_TO_EFFORT as effort_map
+ assert effort_map[ThinkDepth.ULTRADEEP] == "xhigh"
+
+
class TestParadigm:
"""Test Paradigm enum."""
From be587d3cb50d0acf8b5b5821edb9c083532f80a8 Mon Sep 17 00:00:00 2001
From: Joseph Ibrahim
PRISM signal extraction
emotional β mode β domain β task"]
+ B["2 Β· CASCADE
Safety gates + 7-expert MoE
first-match-wins"]
+ C["3 Β· LOCK
MAX3 reflection Β· safety gate
deterministic checksum"]
+ D["4 Β· EXECUTE
Locked-parameter generation
EXEC:checksum Β· expert Β· paradigm Β· altitude Β· depth"]
+ E["5 Β· UPDATE
RC^+ΞΎ convergence tracking
attractor basins"]
+ Out(["Response + persisted state"])
+ In --> A --> B --> C --> D --> E --> Out
+ classDef phase fill:#1F2937,stroke:#1F2937,color:#F5F1EA,stroke-width:0px
+ classDef io fill:#F5F1EA,stroke:#1F2937,color:#1F2937,stroke-width:2px
+ class A,B,C,D,E phase
+ class In,Out io
```
---
@@ -142,6 +131,32 @@ The system protects you from yourself:
---
+## Burnout Escalation
+
+Cognitive state moves between four levels. Escalation tracks observable signals; recovery is always available and is body-first, not productivity-driven.
+
+```mermaid
+%%{init: {'theme':'base','themeVariables':{'primaryColor':'#1F2937','primaryTextColor':'#F5F1EA','primaryBorderColor':'#1F2937','lineColor':'#1F2937','fontFamily':'system-ui, -apple-system, sans-serif'}}}%%
+stateDiagram-v2
+ direction LR
+ [*] --> GREEN
+ GREEN --> YELLOW: typos rising,
shorter messages
+ YELLOW --> ORANGE: frustration,
declining coherence
+ ORANGE --> RED: ALL CAPS,
spiral, incoherence
+ YELLOW --> GREEN: rest, water, break
+ ORANGE --> GREEN: walk, family,
body-first
+ RED --> GREEN: full stop,
body-first protocol
+
+ classDef calm fill:#F5F1EA,stroke:#1F2937,color:#1F2937,stroke-width:2px
+ classDef alert fill:#1F2937,stroke:#1F2937,color:#F5F1EA,stroke-width:0px
+ class GREEN calm
+ class YELLOW,ORANGE,RED alert
+```
+
+Recovery from RED is always **body before brain**: water, walking, family, outside β then back to work when (and only when) the body says so.
+
+---
+
## CLI Commands
```bash