Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ For all projects, install into your user skill directory instead:
python3 tools/pstack_opencodex.py install --target ~/.agents/skills
```

The installer creates symlinks into `dist/skills/`. Keep this checkout in place and rebuild after moving it; generated harness instructions contain absolute paths. Existing real skill directories are protected, but existing symlinks with matching names are replaced.
The installer creates symlinks into `dist/skills/`. Keep this checkout in place because the links and generated harness instructions use absolute paths. After pulling updates, rerun `python3 tools/pstack_opencodex.py build` in the same checkout. The existing links pick up the rebuilt skills. The installer protects existing real skill directories and replaces existing symlinks with matching names.

Start a new Codex session, invoke `$setup-pstack` to choose models available in your catalog, then use `$poteto-mode` for a task. Model settings live in `~/.codex/pstack-models.md`, separately from Cursor's rules. If you use a custom `CODEX_HOME`, pass the corresponding settings and config paths explicitly when needed; the harness documents the default locations.
Start a new Codex session, invoke `$setup-pstack` to choose models available in your catalog, then use `$poteto-mode` for a task. Model settings live in `~/.codex/pstack-models.md`, separately from Cursor's rules. Explicit role settings in that file take precedence over rebuilt skill defaults. Update the model ID on any line where you want the newer version. If you use a custom `CODEX_HOME`, pass the corresponding settings and config paths explicitly when needed. The harness documents the default locations.

[overlay/pstack-models.example.md](overlay/pstack-models.example.md) shows the role format. Its model names are illustrative provider aliases, not a guarantee of availability. Adapt them to your catalog before copying the file. Panel roles that require different model families need suitable models from those families.

Expand Down
24 changes: 12 additions & 12 deletions overlay/pstack-models.example.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# Illustrative provider aliases; availability depends on your catalog and routing configuration.
# Replace these values with your available models, or use $setup-pstack to generate settings.
# budget: unlimited (max)
feature, refactoring: gpt-6.1-sol-xhigh
bug-fix: gpt-6.1-sol-xhigh
perf-issue: gpt-6.1-sol-xhigh
hillclimb: gpt-6.1-sol-xhigh
feature, refactoring: gpt-6.2-sol-xhigh
bug-fix: gpt-6.2-sol-xhigh
perf-issue: gpt-6.2-sol-xhigh
hillclimb: gpt-6.2-sol-xhigh
judgment and prose: anthropic/claude-opus-5-5-max
hardest tasks: anthropic/claude-opus-5-5-max
how explorer: gpt-6.1-sol-xhigh
how explorer: gpt-6.2-sol-xhigh
how explainer: anthropic/claude-opus-5-5-max
why investigators: gpt-6.1-sol-xhigh
why investigators: gpt-6.2-sol-xhigh
why synthesizer: anthropic/claude-opus-5-5-max
reflect tooling: gpt-6.1-sol-max
reflect tooling: gpt-6.2-sol-max
reflect judgment, divergent, synthesizer: anthropic/claude-opus-5-5-max
arena runners: anthropic/claude-opus-5-5-max, gpt-6.1-sol-max, anthropic/claude-fable-5-1-max
arena cross-judge pool: anthropic/claude-opus-5-5-max, gpt-6.1-sol-max, anthropic/claude-fable-5-1-max
swarm workers: gpt-6.1-sol-xhigh
architect runners: anthropic/claude-opus-5-5-max, gpt-6.1-sol-max, anthropic/claude-fable-5-1-max
interrogate reviewers: anthropic/claude-opus-5-5-max, gpt-6.1-sol-max, anthropic/claude-fable-5-1-max
arena runners: anthropic/claude-opus-5-5-max, gpt-6.2-sol-max, anthropic/claude-fable-5-2-max
arena cross-judge pool: anthropic/claude-opus-5-5-max, gpt-6.2-sol-max, anthropic/claude-fable-5-2-max
swarm workers: gpt-6.2-sol-xhigh
architect runners: anthropic/claude-opus-5-5-max, gpt-6.2-sol-max, anthropic/claude-fable-5-2-max
interrogate reviewers: anthropic/claude-opus-5-5-max, gpt-6.2-sol-max, anthropic/claude-fable-5-2-max
38 changes: 28 additions & 10 deletions tests/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
sys.path.insert(0, str(ROOT / "tools"))
from pstack_runtime import diagnose, model_route

SOL = "gpt-6.2-sol"


def models(parent_surface="v1", child_surface="v1"):
return {
"gpt-6.1-sol": {"slug": "gpt-6.1-sol", "use_responses_lite": True, "multi_agent_version": parent_surface, "supported_reasoning_levels": [{"effort": "max"}]},
SOL: {"slug": SOL, "use_responses_lite": True, "multi_agent_version": parent_surface, "supported_reasoning_levels": [{"effort": "max"}]},
"anthropic/claude-opus-5-5": {"slug": "anthropic/claude-opus-5-5", "multi_agent_version": child_surface, "supported_reasoning_levels": [{"effort": "max"}]},
}


class RuntimeRules(unittest.TestCase):
def report(self, surface, records=None, config=None, codex=None):
return diagnose("gpt-6.1-sol", {"anthropic/claude-opus-5-5": ["how explainer"]}, records or models(), codex or {}, config or {"multiAgentMode": "v1"}, surface)
return diagnose(SOL, {"anthropic/claude-opus-5-5": ["how explainer"]}, records or models(), codex or {}, config or {"multiAgentMode": "v1"}, surface)

def codes(self, report):
return {issue["code"] for issue in report["issues"]}
Expand Down Expand Up @@ -63,20 +65,20 @@ def test_each_experimental_mitigation_requires_live_confirmation(self):

def test_routed_parent_does_not_have_native_ciphertext_constraint(self):
records = models(parent_surface="v2")
records["gpt-6.1-sol"]["use_responses_lite"] = False
records["gpt-6.1-sol"]["opencodex_catalog_kind"] = "combo-native-alias-v1"
records[SOL]["use_responses_lite"] = False
records[SOL]["opencodex_catalog_kind"] = "combo-native-alias-v1"
report = self.report("v2", records)
self.assertEqual(report["status"], "CONFIGURATION_OK")

def test_unknown_parent_route_is_inconclusive(self):
records = models(parent_surface="v2")
del records["gpt-6.1-sol"]["use_responses_lite"]
del records[SOL]["use_responses_lite"]
report = self.report("v2", records)
self.assertEqual(report["status"], "INCONCLUSIVE")
self.assertIn("route_unknown", self.codes(report))

def test_native_forward_metadata_precedes_provider_namespace(self):
self.assertEqual(model_route({"slug": "openai-codex/gpt-6.1-sol", "use_responses_lite": True}), "native")
self.assertEqual(model_route({"slug": f"openai-codex/{SOL}", "use_responses_lite": True}), "native")
self.assertEqual(model_route({"slug": "openai-codex/unknown"}), "unknown")

def test_global_override_conflicts_with_hybrid_native_v1(self):
Expand Down Expand Up @@ -105,7 +107,23 @@ def write_catalog(self, records):
self.catalog.write_text(json.dumps({"models": list(records.values())}))

def run_cli(self, *extra):
return subprocess.run([sys.executable, str(ROOT / "tools/pstack_opencodex.py"), "check-runtime", "--parent-model", "gpt-6.1-sol", "--file", str(self.roles), "--codex-config", str(self.codex), "--opencodex-config", str(self.opencodex), "--json", *extra], text=True, capture_output=True, timeout=10)
return subprocess.run([sys.executable, str(ROOT / "tools/pstack_opencodex.py"), "check-runtime", "--parent-model", SOL, "--file", str(self.roles), "--codex-config", str(self.codex), "--opencodex-config", str(self.opencodex), "--json", *extra], text=True, capture_output=True, timeout=10)

def test_build_and_preflight_use_the_current_sol_default(self):
dist = self.root / "dist"
subprocess.run(
[sys.executable, str(ROOT / "tools/pstack_opencodex.py"), "build", "--out", str(dist)],
check=True, capture_output=True, timeout=10,
)
for skill in ("architect", "arena", "interrogate", "reflect", "setup-pstack"):
with self.subTest(skill=skill):
text = (dist / "skills" / skill / "SKILL.md").read_text()
self.assertIn(f"{SOL}-max", text)
self.assertNotIn("gpt-5.6-sol", text)

result = self.run_cli("--defaults", "--role", "reflect tooling", "--session-surface", "v1")
self.assertEqual(result.returncode, 0, result.stdout)
self.assertEqual(json.loads(result.stdout)["children"][0]["model"], SOL)

def test_default_cli_reads_authoritative_catalog_and_leaves_settings_intact(self):
files = [self.catalog, self.roles, self.codex, self.opencodex]
Expand Down Expand Up @@ -157,7 +175,7 @@ def test_selected_native_role_is_not_blocked_by_unused_routed_roles(self):
result = self.run_cli("--role", "swarm workers", "--session-surface", "v2")
report = json.loads(result.stdout)
self.assertEqual(result.returncode, 0, result.stdout)
self.assertEqual([child["model"] for child in report["children"]], ["gpt-6.1-sol"])
self.assertEqual([child["model"] for child in report["children"]], [SOL])

def test_unknown_role_or_profile_returns_a_failed_diagnostic(self):
for option in ("--role", "--profile"):
Expand All @@ -171,11 +189,11 @@ def test_inherited_role_resolves_to_actual_parent(self):
self.write_catalog(models(parent_surface="v2"))
result = self.run_cli("--session-surface", "v2")
self.assertEqual(result.returncode, 0, result.stdout)
self.assertEqual(json.loads(result.stdout)["children"][0]["model"], "gpt-6.1-sol")
self.assertEqual(json.loads(result.stdout)["children"][0]["model"], SOL)

def test_bad_input_fails_with_json_instead_of_traceback(self):
bad_efforts = models()
bad_efforts["gpt-6.1-sol"]["supported_reasoning_levels"] = [{}]
bad_efforts[SOL]["supported_reasoning_levels"] = [{}]
for contents in ("not-json", "[]", '{"models": [null]}', json.dumps({"models": list(bad_efforts.values())})):
with self.subTest(contents=contents):
self.catalog.write_text(contents)
Expand Down
19 changes: 12 additions & 7 deletions tools/pstack_opencodex.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,15 @@ def split_frontmatter(text: str) -> tuple[list[str], str]:
return text[4:end].splitlines(), text[end + 5 :]


def read_codex_skill(path: Path) -> str:
"""Apply the Codex Sol pin while preserving the effort in the vendored skill."""
return re.sub(r"\bgpt-5\.6-sol\b", "gpt-6.2-sol", path.read_text())


def adapt_skill(skill_dir: Path, dist: Path) -> bool:
"""Normalize the name, map disable-model-invocation, add the harness pointer."""
skill_md = skill_dir / "SKILL.md"
front, body = split_frontmatter(skill_md.read_text())
front, body = split_frontmatter(read_codex_skill(skill_md))
explicit_only = any(line.strip() == "disable-model-invocation: true" for line in front)
front = [f"name: {skill_dir.name}" if line.startswith("name:") else line for line in front]
pointer = "" if skill_dir.name.startswith("principle-") else POINTER.format(dist=dist)
Expand Down Expand Up @@ -213,8 +218,8 @@ def parse_roles(text: str) -> dict[str, list[str]]:
return roles


def upstream_roles() -> dict[str, list[str]]:
text = (UPSTREAM_DIR / "skills" / "setup-pstack" / "SKILL.md").read_text()
def default_roles() -> dict[str, list[str]]:
text = read_codex_skill(UPSTREAM_DIR / "skills" / "setup-pstack" / "SKILL.md")
block = re.search(r"### 5\..*?" + FENCE + r"\n(.*?)" + FENCE, text, re.S)
if not block:
raise SystemExit("could not find the role template in upstream setup-pstack; review check-models")
Expand All @@ -223,9 +228,9 @@ def upstream_roles() -> dict[str, list[str]]:

def cmd_check_models(args: argparse.Namespace) -> None:
catalog = load_catalog(Path(args.catalog))
defaults = upstream_roles()
defaults = default_roles()
if args.defaults:
roles, source = defaults, "upstream defaults"
roles, source = defaults, "Codex skill defaults"
else:
path = Path(args.file).expanduser()
if not path.exists():
Expand Down Expand Up @@ -267,7 +272,7 @@ def cmd_check_runtime(args: argparse.Namespace) -> None:
parent = match_slug(split_effort(args.parent_model)[0], catalog)
if parent is None:
raise ValueError("parent model is not in the selected catalog")
known_roles = upstream_roles()
known_roles = default_roles()
roles = known_roles if args.defaults else parse_roles(Path(args.file).expanduser().read_text())
if not roles:
raise ValueError("no model roles found")
Expand Down Expand Up @@ -351,7 +356,7 @@ def main() -> None:
check = sub.add_parser("check-models", help="resolve pstack model settings against the Codex catalog")
check.add_argument("--file", default=str(DEFAULT_MODELS_FILE))
check.add_argument("--catalog", default=str(DEFAULT_CATALOG))
check.add_argument("--defaults", action="store_true", help="check upstream's default role table instead")
check.add_argument("--defaults", action="store_true", help="check the Codex skill defaults")
check.set_defaults(func=cmd_check_models)
runtime = sub.add_parser("check-runtime", help="read-only delegation preflight; existing-session uncertainty returns exit 2")
runtime.add_argument("--parent-model", required=True)
Expand Down