From cebcc1b649969deea63c8eb00f6a7129d55c18fe Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 3 Jul 2026 10:14:35 -0400 Subject: [PATCH] Migrate os-orchestration plugin from cc-plugins into cc-os Renamed orchestration -> os-orchestration per naming convention, kept the plugin's permissive delegation rule as the canonical global default, and dropped cc-os's stricter local override so this repo behaves like every other project (ADR-019). Co-Authored-By: Claude Sonnet 5 --- .../.claude-plugin/plugin.json | 5 +++ plugins/os-orchestration/ORCHESTRATION.md | 10 ++++++ plugins/os-orchestration/hooks/hooks.json | 16 ++++++++++ plugins/os-orchestration/hooks/inject.py | 31 +++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 plugins/os-orchestration/.claude-plugin/plugin.json create mode 100644 plugins/os-orchestration/ORCHESTRATION.md create mode 100644 plugins/os-orchestration/hooks/hooks.json create mode 100755 plugins/os-orchestration/hooks/inject.py diff --git a/plugins/os-orchestration/.claude-plugin/plugin.json b/plugins/os-orchestration/.claude-plugin/plugin.json new file mode 100644 index 0000000..5e92cd5 --- /dev/null +++ b/plugins/os-orchestration/.claude-plugin/plugin.json @@ -0,0 +1,5 @@ +{ + "name": "os-orchestration", + "version": "0.1.0", + "description": "Session orchestration rules (delegation threshold, explicit model routing on Agent spawns) injected at session start and after compaction." +} diff --git a/plugins/os-orchestration/ORCHESTRATION.md b/plugins/os-orchestration/ORCHESTRATION.md new file mode 100644 index 0000000..bbb57f5 --- /dev/null +++ b/plugins/os-orchestration/ORCHESTRATION.md @@ -0,0 +1,10 @@ +## Session orchestration + +- Do single-file, ≤2-tool-call ops directly. Don't delegate them. Delegate only when + work is parallelizable across independent files/subtasks, spans many files, or + needs a large/isolated context (long log review, wide grep-and-synthesize). +- Every `Agent` spawn passes `model` explicitly. Default `haiku` for mechanical + file-edit/shell work; `sonnet` for anything requiring judgment; `opus` only for + genuinely hard reasoning. +- A short orienting Read before delegating is fine when the target file/path is + uncertain. Don't delegate the orienting step itself. diff --git a/plugins/os-orchestration/hooks/hooks.json b/plugins/os-orchestration/hooks/hooks.json new file mode 100644 index 0000000..1588468 --- /dev/null +++ b/plugins/os-orchestration/hooks/hooks.json @@ -0,0 +1,16 @@ +{ + "hooks": { + "SessionStart": [ + { + "matcher": "startup|resume|clear|compact", + "hooks": [ + { + "type": "command", + "command": "python3 ${CLAUDE_PLUGIN_ROOT}/hooks/inject.py", + "timeout": 5 + } + ] + } + ] + } +} diff --git a/plugins/os-orchestration/hooks/inject.py b/plugins/os-orchestration/hooks/inject.py new file mode 100755 index 0000000..9414fcf --- /dev/null +++ b/plugins/os-orchestration/hooks/inject.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""SessionStart hook: inject ORCHESTRATION.md as additionalContext. + +Fires on startup/resume/clear, and on 'compact' (matcher includes it) so the +rules survive a context-compaction pass, not just the first turn. +""" +import json +import os +import sys + +PLUGIN_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +ORCHESTRATION_FILE = os.path.join(PLUGIN_ROOT, "ORCHESTRATION.md") + + +def main(): + try: + with open(ORCHESTRATION_FILE) as f: + context = f.read() + except OSError: + return + + print(json.dumps({ + "hookSpecificOutput": { + "hookEventName": "SessionStart", + "additionalContext": context, + } + })) + + +if __name__ == "__main__": + sys.exit(main())