orca-agent-workflow 0.2.0__py3-none-any.whl

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.
Files changed (57) hide show
  1. orca_agent_workflow/__init__.py +3 -0
  2. orca_agent_workflow/__main__.py +3 -0
  3. orca_agent_workflow/adoption.py +33 -0
  4. orca_agent_workflow/check_sync.py +93 -0
  5. orca_agent_workflow/cli.py +83 -0
  6. orca_agent_workflow/codex_review.py +364 -0
  7. orca_agent_workflow/doctor.py +33 -0
  8. orca_agent_workflow/gate.Dockerfile +9 -0
  9. orca_agent_workflow/install.py +313 -0
  10. orca_agent_workflow/migrate.py +178 -0
  11. orca_agent_workflow/native.py +142 -0
  12. orca_agent_workflow/resume_dispatch.py +160 -0
  13. orca_agent_workflow/review_gate.py +291 -0
  14. orca_agent_workflow/run_gates.py +263 -0
  15. orca_agent_workflow/sensitive.json +19 -0
  16. orca_agent_workflow/start.py +293 -0
  17. orca_agent_workflow/task_plan.py +301 -0
  18. orca_agent_workflow/task_scope.py +1256 -0
  19. orca_agent_workflow/template/AGENTS.md +49 -0
  20. orca_agent_workflow/template/CLAUDE.md +4 -0
  21. orca_agent_workflow/template/agents/LICENSE +21 -0
  22. orca_agent_workflow/template/agents/README.md +78 -0
  23. orca_agent_workflow/template/agents/WORKFLOW.md +65 -0
  24. orca_agent_workflow/template/agents/docs/cross-provider.md +79 -0
  25. orca_agent_workflow/template/agents/docs/roles/implementer.md +15 -0
  26. orca_agent_workflow/template/agents/docs/task-permissions.md +124 -0
  27. orca_agent_workflow/template/agents/skills/project-handoff/SKILL.md +23 -0
  28. orca_agent_workflow/template/agents/skills/review-pr/SKILL.md +41 -0
  29. orca_agent_workflow/template/agents/skills/review-pr/references/record.example.json +31 -0
  30. orca_agent_workflow/template/agents/skills/review-pr/references/reviewer.md +20 -0
  31. orca_agent_workflow/template/agents/skills/session-recover/SKILL.md +17 -0
  32. orca_agent_workflow/template/agents/skills/session-recover/references/recovery.md +38 -0
  33. orca_agent_workflow/template/agents/skills/session-recover/scripts/session_context.py +239 -0
  34. orca_agent_workflow/template/agents/skills/spec-and-delegate/SKILL.md +37 -0
  35. orca_agent_workflow/template/agents/skills/spec-and-delegate/references/spec-template.md +46 -0
  36. orca_agent_workflow/template/agents/skills/start-task/SKILL.md +72 -0
  37. orca_agent_workflow/template/agents/workflow.json +64 -0
  38. orca_agent_workflow/template/agents/workflow.py +82 -0
  39. orca_agent_workflow/template/claude/skills/project-handoff/SKILL.md +12 -0
  40. orca_agent_workflow/template/claude/skills/review-pr/SKILL.md +12 -0
  41. orca_agent_workflow/template/claude/skills/session-recover/SKILL.md +12 -0
  42. orca_agent_workflow/template/claude/skills/spec-and-delegate/SKILL.md +12 -0
  43. orca_agent_workflow/template/claude/skills/start-task/SKILL.md +12 -0
  44. orca_agent_workflow/template/gitattributes +5 -0
  45. orca_agent_workflow/template/githooks/pre-push +11 -0
  46. orca_agent_workflow/template/gitignore +3 -0
  47. orca_agent_workflow/template/opencode/commands/project-handoff.md +7 -0
  48. orca_agent_workflow/template/opencode/commands/review-pr.md +7 -0
  49. orca_agent_workflow/template/opencode/commands/session-recover.md +7 -0
  50. orca_agent_workflow/template/opencode/commands/spec-and-delegate.md +7 -0
  51. orca_agent_workflow/template/opencode/commands/start-task.md +9 -0
  52. orca_agent_workflow-0.2.0.dist-info/METADATA +214 -0
  53. orca_agent_workflow-0.2.0.dist-info/RECORD +57 -0
  54. orca_agent_workflow-0.2.0.dist-info/WHEEL +5 -0
  55. orca_agent_workflow-0.2.0.dist-info/entry_points.txt +2 -0
  56. orca_agent_workflow-0.2.0.dist-info/licenses/LICENSE +21 -0
  57. orca_agent_workflow-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,239 @@
1
+ #!/usr/bin/env python3
2
+ # /// script
3
+ # requires-python = ">=3.10"
4
+ # ///
5
+ """Read local Claude/Codex JSONL history without a model call or session mutation."""
6
+
7
+ import argparse
8
+ from collections import deque
9
+ import json
10
+ import os
11
+ from pathlib import Path
12
+ import re
13
+ import sys
14
+
15
+
16
+ def records(path, limit=None):
17
+ """Read a fixed prefix: a live writer cannot extend this read indefinitely."""
18
+ remaining = path.stat().st_size if limit is None else limit
19
+ with path.open("rb") as stream:
20
+ while remaining > 0:
21
+ line = stream.readline(remaining)
22
+ remaining -= len(line)
23
+ if not line:
24
+ break
25
+ try:
26
+ item = json.loads(line)
27
+ except (json.JSONDecodeError, UnicodeDecodeError):
28
+ # A writer may not have completed its final JSONL record yet.
29
+ if remaining == 0 and not line.endswith(b"\n"):
30
+ break
31
+ raise ValueError("Malformed JSONL record; refusing a silent partial recovery")
32
+ if isinstance(item, dict):
33
+ yield item
34
+
35
+
36
+ def identity(path, agent):
37
+ for item in records(path):
38
+ if agent == "codex" and item.get("type") == "session_meta":
39
+ p = item.get("payload", {})
40
+ return {
41
+ "id": p.get("id"),
42
+ "cwd": p.get("cwd"),
43
+ "subagent": isinstance(p.get("source"), dict),
44
+ }
45
+ if agent == "claude" and item.get("cwd") and item.get("sessionId"):
46
+ return {
47
+ "id": item["sessionId"],
48
+ "cwd": item["cwd"],
49
+ "subagent": bool(item.get("isSidechain")),
50
+ }
51
+ raise ValueError("No supported session identity/cwd in transcript")
52
+
53
+
54
+ def same_cwd(actual, expected):
55
+ # Do not resolve deleted legacy paths into unrelated projects by name.
56
+ return bool(actual) and os.path.normpath(actual) == os.path.normpath(str(expected))
57
+
58
+
59
+ def text_blocks(value):
60
+ if isinstance(value, str):
61
+ return value
62
+ if isinstance(value, list):
63
+ return "\n".join(
64
+ block.get("text", "")
65
+ for block in value
66
+ if isinstance(block, dict)
67
+ and block.get("type") in {"text", "input_text", "output_text"}
68
+ )
69
+ return ""
70
+
71
+
72
+ def events(path, agent, size):
73
+ if agent == "codex":
74
+ for item in records(path, size):
75
+ p = item.get("payload", {})
76
+ if item.get("type") == "response_item":
77
+ if p.get("type") == "message" and p.get("role") in {"user", "assistant"}:
78
+ if p.get("channel") in {"analysis", "summary", "justify", "confidence"}:
79
+ continue
80
+ body = text_blocks(p.get("content"))
81
+ if body:
82
+ yield p["role"], body
83
+ elif p.get("type") in {"function_call", "custom_tool_call"}:
84
+ yield "tool call", p.get("name", "unknown") + "\n" + str(
85
+ p.get("arguments", p.get("input", ""))
86
+ )
87
+ elif p.get("type") in {"function_call_output", "custom_tool_call_output"}:
88
+ yield "tool result", text_blocks(p.get("output", ""))
89
+ elif item.get("type") == "compacted":
90
+ if p.get("message"):
91
+ yield "compaction summary", str(p["message"])
92
+ else:
93
+ # Follow the latest main-chain leaf so rewound/abandoned branches are not
94
+ # presented as the active conversation. Keep non-message parent nodes too.
95
+ nodes = {}
96
+ leaf = None
97
+ for item in records(path, size):
98
+ if item.get("isSidechain") or not item.get("uuid"):
99
+ continue
100
+ nodes[item["uuid"]] = item
101
+ if item.get("type") in {"user", "assistant"}:
102
+ leaf = item["uuid"]
103
+ chain = []
104
+ seen = set()
105
+ while leaf and leaf in nodes and leaf not in seen:
106
+ seen.add(leaf)
107
+ node = nodes[leaf]
108
+ chain.append(node)
109
+ leaf = node.get("parentUuid")
110
+ for item in reversed(chain):
111
+ if item.get("type") not in {"user", "assistant"}:
112
+ continue
113
+ message = item.get("message", {})
114
+ content = message.get("content", "")
115
+ body = text_blocks(content)
116
+ if body:
117
+ yield item["type"], body
118
+ if isinstance(content, list):
119
+ for block in content:
120
+ if not isinstance(block, dict):
121
+ continue
122
+ if block.get("type") == "tool_use":
123
+ yield "tool call", block.get("name", "unknown") + "\n" + json.dumps(
124
+ block.get("input", {}), ensure_ascii=False
125
+ )
126
+ elif block.get("type") == "tool_result":
127
+ yield "tool result", text_blocks(block.get("content", ""))
128
+
129
+
130
+ def main():
131
+ parser = argparse.ArgumentParser(description=__doc__)
132
+ parser.add_argument("mode", choices=["list", "read"])
133
+ parser.add_argument("--agent", required=True, choices=["claude", "codex"])
134
+ parser.add_argument(
135
+ "--cwd",
136
+ required=True,
137
+ type=Path,
138
+ help="Exact source session cwd, not just repository name",
139
+ )
140
+ parser.add_argument("--file", type=Path, help="Explicit JSONL path for read")
141
+ parser.add_argument("--root", type=Path, help="Override provider history root")
142
+ parser.add_argument("--limit", type=int, default=10, help="Maximum listed sessions")
143
+ parser.add_argument("--events", type=int, default=40, help="Recent read events")
144
+ parser.add_argument("--chars", type=int, default=2000, help="Characters per event")
145
+ args = parser.parse_args()
146
+ if not args.cwd.is_absolute() or min(args.limit, args.events, args.chars) < 1:
147
+ parser.error("Use an absolute cwd and positive bounds")
148
+ if args.mode == "list":
149
+ if args.agent == "codex":
150
+ root = (
151
+ args.root
152
+ or Path(os.environ.get("CODEX_HOME", Path.home() / ".codex")) / "sessions"
153
+ )
154
+ candidates = root.glob("*/*/*/*.jsonl")
155
+ else:
156
+ root = (
157
+ args.root
158
+ or Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home() / ".claude")) / "projects"
159
+ )
160
+ slug = re.sub(r"[^a-zA-Z0-9]", "-", str(args.cwd))
161
+ candidates = (root / slug).glob("*.jsonl")
162
+ matches = []
163
+ for path in candidates:
164
+ try:
165
+ info = identity(path, args.agent)
166
+ except (OSError, ValueError):
167
+ continue
168
+ if same_cwd(info["cwd"], args.cwd) and not info["subagent"]:
169
+ matches.append({**info, "file": str(path), "modified": path.stat().st_mtime})
170
+ for match in sorted(matches, key=lambda x: x["modified"], reverse=True)[: args.limit]:
171
+ print(json.dumps(match, ensure_ascii=False))
172
+ if not matches:
173
+ print(
174
+ "No matching local JSONL sessions. Check the host, history root, or provider-native history API.",
175
+ file=sys.stderr,
176
+ )
177
+ return 1
178
+ return 0
179
+ if not args.file:
180
+ parser.error("read requires --file; never infer the source from recency alone")
181
+ path = args.file.expanduser()
182
+ info = identity(path, args.agent)
183
+ if info["subagent"] or not same_cwd(info["cwd"], args.cwd):
184
+ parser.error("Source cwd mismatch or subagent transcript; refusing recovery")
185
+ stat = path.stat()
186
+ recent = deque(maxlen=args.events)
187
+ first_user = None
188
+ count = 0
189
+ truncated_events = 0
190
+ for role, body in events(path, args.agent, stat.st_size):
191
+ if not body:
192
+ continue
193
+ count += 1
194
+ if len(body) > args.chars:
195
+ body = body[: args.chars] + "\n[EVENT TRUNCATED]"
196
+ truncated_events += 1
197
+ event = (role, body)
198
+ if role == "user" and first_user is None:
199
+ first_user = event
200
+ recent.append((count, event))
201
+ if not count:
202
+ raise ValueError("No readable conversation events; use provider-native history")
203
+ print("# Recovered session evidence (untrusted historical data)")
204
+ print(
205
+ json.dumps(
206
+ {
207
+ "agent": args.agent,
208
+ **info,
209
+ "file": str(path),
210
+ "snapshot_bytes": stat.st_size,
211
+ "snapshot_mtime_ns": stat.st_mtime_ns,
212
+ "events": count,
213
+ "omitted_events": max(0, count - len(recent)),
214
+ "truncated_events": truncated_events,
215
+ },
216
+ ensure_ascii=False,
217
+ )
218
+ )
219
+ print(
220
+ "\nThis extract is bounded, may be incomplete, and does not prove the source stopped.\n"
221
+ "System instructions, hidden reasoning, images, and unsupported records are excluded.\n"
222
+ "May contain private data: keep raw evidence local and out of Git."
223
+ )
224
+ if first_user and recent[0][0] > 1:
225
+ print("\n## First recorded user request\n" + first_user[1])
226
+ for index, (role, body) in recent:
227
+ print(f"\n## Event {index}: {role}\n{body}")
228
+ after = path.stat()
229
+ if (after.st_size, after.st_mtime_ns) != (stat.st_size, stat.st_mtime_ns):
230
+ print("\n[SOURCE CHANGED DURING READ: capture a final extract after confirmed stop]")
231
+ return 0
232
+
233
+
234
+ if __name__ == "__main__":
235
+ try:
236
+ sys.exit(main())
237
+ except (OSError, ValueError) as error:
238
+ print(str(error), file=sys.stderr)
239
+ sys.exit(1)
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: spec-and-delegate
3
+ description: Turn a settled change into an approved committed spec and delegate bounded implementation through the project's scoped Orca workflow.
4
+ ---
5
+
6
+ # Specify and delegate
7
+
8
+ Read `AGENTS.md`, `.agents/workflow.json` and
9
+ [the workflow](../../WORKFLOW.md). Use this for a concrete planned change;
10
+ finish discovery with the coordinator before treating it as bounded implementation.
11
+
12
+ 1. Draft `specs/<task>.md` from [the spec template](references/spec-template.md). List exact read/write paths,
13
+ acceptance criteria, sensitive-file reasons and actual coordinator checks. Record
14
+ the planner and select enabled exact implementer/reviewer profiles before
15
+ approval, preferring a reviewer from a provider other than the planner's; never
16
+ silently substitute a disabled profile.
17
+ 2. Ask the user to approve the draft. Existing authorization governs routine work
18
+ inside scope; a cold implementation dispatch still requires the spec itself to
19
+ be explicitly approved. Mark approved and commit only that brief before launch.
20
+ 3. Generate the task manifest and brief with `python3 .agents/workflow.py plan`. Prepare,
21
+ probe and launch the scoped client using [task permissions](../../docs/task-permissions.md).
22
+ Read Orca's installed orchestration guide and attach the exact scoped terminal.
23
+ Include the shared implementer role and every context path in the readable scope.
24
+ 4. Workers use file tools, scoped questions/mailbox and report; no shell or recursive
25
+ delegation. Explain the exact Task/Dispatch IDs and completion protocol. End your
26
+ turn after independent Orca dispatch; the runtime wakes you with replies/results.
27
+ 5. Inspect the full diff, run the approved checks with the trusted gate runner,
28
+ reconcile docs and commit scoped work. Never execute worker-written code with
29
+ inherited credentials or an unreviewed build/gate definition.
30
+ 6. Use `review-pr` for a fresh complete-branch review of final base/head. Fix blockers
31
+ within the configured automatic-round limit; new commits require fresh evidence.
32
+ Report remaining blockers to the user when that limit is exhausted.
33
+ 7. Open a PR only within authorization. CI and current review remain required;
34
+ a human merges. Record actual outcomes and verification limits.
35
+
36
+ Direct coordinator changes remain subject to project scope and review policy and
37
+ do not require an artificial implementation worker when it would add no value.
@@ -0,0 +1,46 @@
1
+ ---
2
+ title: Describe the intended change
3
+ status: draft
4
+ ---
5
+
6
+ # Task brief
7
+
8
+ ## Routing
9
+
10
+ Record the exact enabled implementer and independent reviewer profiles selected
11
+ from `.agents/workflow.json`, and the coordinator/project worktree.
12
+
13
+ ```agent-task
14
+ {
15
+ "tier": "light",
16
+ "implementer": {"read": [], "write": [], "sensitive": []},
17
+ "review": {"read": []}
18
+ }
19
+ ```
20
+
21
+ ## Goal and acceptance
22
+
23
+ Describe observable behavior, exact inputs/outputs and how success will be checked.
24
+
25
+ ## Context
26
+
27
+ List exact files the worker/reviewer should read; they cannot list directories.
28
+
29
+ ## Changes and scope
30
+
31
+ List exact file changes. Workers create/overwrite approved files only. Assign
32
+ directory creation, renames, deletions and command execution to the coordinator.
33
+
34
+ ## Sensitive files
35
+
36
+ None. For a full-tier task, replace this with each sensitive file and its reason.
37
+
38
+ ## Verification and operational permissions
39
+
40
+ List actual coordinator gate commands, trusted dependencies and expected outputs.
41
+ Infrastructure/network/credentials/service operations: none unless separately
42
+ approved with an exact target, action, purpose and expiry. Workers get none.
43
+
44
+ ## Out of scope
45
+
46
+ Record explicit task boundaries and decisions the worker must not expand.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: start-task
3
+ description: Coordinate a substantive implementation task in this Orca project, from discovery through scoped implementation, checks and review. Use for new features, substantial fixes and refactors; continue existing tasks in place. Skip questions, read-only work, tiny edits and explicitly assigned worker/reviewer jobs.
4
+ ---
5
+
6
+ # Start a task
7
+
8
+ Turn the user's ordinary task request into a coordinated change. The current
9
+ session is the coordinator; the request supplies the goal. Do not ask the user to
10
+ initialize an orchestrator or repeat a kickoff prompt.
11
+
12
+ ## Establish ownership and scope
13
+
14
+ Read the project's `AGENTS.md`, `.agents/workflow.json`
15
+ and [workflow](../../WORKFLOW.md), plus relevant application guidance.
16
+
17
+ - Honor an explicit worker/reviewer assignment or Task/Dispatch IDs first. Follow
18
+ that role and its scope; do not promote yourself to coordinator or dispatch
19
+ nested workers. A request to arrange a branch/PR review uses `review-pr`;
20
+ a dispatched reviewer follows its injected review contract, not the arranging
21
+ steps of that skill.
22
+ - For a follow-up, resume the current task, approved scope and pending checks.
23
+ Recover the exact session when necessary; do not create another task/worktree
24
+ merely because a new message arrived.
25
+ - Answer questions and perform read-only investigation directly. Handle small,
26
+ understood, low-risk edits directly under project rules. Classify by behavior,
27
+ uncertainty and risk, not file or line count. If an investigation leads to a
28
+ substantive change, use this intake before implementing it.
29
+
30
+ Inspect Git status and the relevant code before editing. Reuse a workspace already
31
+ owned by this task. Preserve unrelated work; if isolation is needed, use Orca's
32
+ installed workspace guidance to prepare a task checkout from committed files.
33
+ Never move, stash or commit unrelated changes to make a checkout clean. Do not
34
+ launch a second writer in an occupied checkout.
35
+
36
+ `python3 .agents/workflow.py start` is an optional launcher for a **new** coordinator session; do
37
+ not call it as initialization from an existing coordinator. If a separate client
38
+ is actually needed, make one explicit handoff with the objective, workspace,
39
+ branch/HEAD, current scope, evidence and next action; verify the original writer
40
+ has stopped before takeover.
41
+
42
+ ## Make the work concrete
43
+
44
+ Investigate enough to state the intended behavior and observable acceptance
45
+ criteria. Explain the approach briefly. Ask only for missing product decisions or
46
+ constraints that affect the result; continue independent discovery meanwhile.
47
+ Do not ask for approval to read code or perform already authorized routine work.
48
+
49
+ Check the project's actual verification commands, trusted gate dependencies and
50
+ enabled role/model profiles. Use the current session for discovery; before any
51
+ worker dispatch, resolve coordinator eligibility, account/model availability,
52
+ Orca readiness and scoped adapter probes using the installed guidance. Missing
53
+ readiness blocks the affected dispatch, not independent planning. Never silently
54
+ enable a disabled provider/profile or fall back to an unconstrained worker.
55
+
56
+ When the implementation plan is bounded, follow
57
+ [spec-and-delegate](../spec-and-delegate/SKILL.md): draft the spec, obtain explicit
58
+ approval of that spec and commit it before launching a cold implementer. A task
59
+ request alone is not approval of a spec that has not yet been written. Reuse an
60
+ existing approved spec when the task remains inside its scope. Direct coordinator
61
+ changes remain possible when delegation adds no value; do not invent a worker or
62
+ an approval ceremony for a small edit.
63
+
64
+ ## Carry the task through
65
+
66
+ Keep the same coordinator responsible for dispatch, questions, complete-diff
67
+ inspection, meaningful checks, documentation and fresh independent review under
68
+ the project contract. Use the existing authorization for commits/publication;
69
+ leave PR merge to the human. Report actual results and anything still blocked.
70
+ Instruction-based routing helps the agent select this workflow; the scoped tools
71
+ and review gates enforce their own boundaries. Do not claim the skill itself is
72
+ an execution hook or proof that worker/model access is qualified.
@@ -0,0 +1,64 @@
1
+ {
2
+ "version": 1,
3
+ "runtime": {
4
+ "package": "orca-agent-workflow",
5
+ "version": "@@VERSION@@"
6
+ },
7
+ "project": {
8
+ "name": "@@NAME@@",
9
+ "repository": "@@REPOSITORY@@",
10
+ "stack": "other",
11
+ "checks": []
12
+ },
13
+ "max_fix_rounds": 2,
14
+ "reviewer_provider_differs_from_planner": "preferred",
15
+ "roles": {
16
+ "planner": [
17
+ {
18
+ "agent": "claude",
19
+ "model": "claude-opus-5-5",
20
+ "enabled": true
21
+ },
22
+ {
23
+ "agent": "codex",
24
+ "model": "gpt-6.2-sol",
25
+ "enabled": true
26
+ }
27
+ ],
28
+ "implementer": [
29
+ {
30
+ "agent": "claude",
31
+ "model": "claude-sonnet-5-5",
32
+ "enabled": true
33
+ },
34
+ {
35
+ "agent": "codex",
36
+ "model": null,
37
+ "enabled": false,
38
+ "blocked_reason": "native_capability_scope_unverified"
39
+ }
40
+ ],
41
+ "reviewer": [
42
+ {
43
+ "agent": "claude",
44
+ "model": "claude-opus-5-5",
45
+ "enabled": true
46
+ },
47
+ {
48
+ "agent": "codex",
49
+ "model": "gpt-6.1-sol",
50
+ "enabled": false,
51
+ "requires": "passing `python3 .agents/workflow.py codex-review qualify` for the installed Codex binary",
52
+ "blocked_reason": "qualify the installed binary/profile/adapter on this machine before enabling"
53
+ }
54
+ ]
55
+ },
56
+ "gates": {
57
+ "dockerfile": null,
58
+ "inputs": [],
59
+ "timeout_seconds": 900,
60
+ "memory": "2g",
61
+ "note": "null uses the runtime's standard-library Python image. Name a reviewed Dockerfile and its build inputs to add the application's runtime and dependencies."
62
+ },
63
+ "sensitive_patterns": []
64
+ }
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env python3
2
+ """Run this project's pinned orca-agent-workflow runtime. Python 3.11+.
3
+
4
+ Usage: python3 .agents/workflow.py <command> [options] (commands: --help)
5
+
6
+ The runtime is the folder named by ORCA_AGENT_WORKFLOW_RUNTIME, else the vendored
7
+ copy in .agents/runtime/ when present, otherwise
8
+ `uvx orca-agent-workflow@<version>` with the version pinned in .agents/workflow.json.
9
+ This launcher runs from the current checkout: for trusted steps (the review gate),
10
+ run the version pinned by the reviewed base, as the review-pr skill describes.
11
+ """
12
+
13
+ import json
14
+ import os
15
+ import subprocess
16
+ import sys
17
+ from pathlib import Path
18
+
19
+ AGENTS = Path(__file__).resolve().parent
20
+ ROOT = AGENTS.parent
21
+
22
+
23
+ def runtime_folder():
24
+ # A runtime folder chosen in the user's own environment (development, CI, tests).
25
+ chosen = os.environ.get("ORCA_AGENT_WORKFLOW_RUNTIME")
26
+ if chosen:
27
+ return Path(chosen)
28
+ vendored = AGENTS / "runtime"
29
+ if (vendored / "orca_agent_workflow" / "__init__.py").is_file():
30
+ return vendored
31
+ # The kit's own repository runs itself from source.
32
+ pyproject = ROOT / "pyproject.toml"
33
+ source = ROOT / "src"
34
+ if (source / "orca_agent_workflow" / "__init__.py").is_file() and pyproject.is_file():
35
+ if 'name = "orca-agent-workflow"' in pyproject.read_text(encoding="utf-8"):
36
+ return source
37
+ return None
38
+
39
+
40
+ def find_uvx():
41
+ """uvx from absolute PATH entries outside this checkout; Windows would search here first."""
42
+ names = ("uvx.exe",) if os.name == "nt" else ("uvx",)
43
+ for entry in os.environ.get("PATH", "").split(os.pathsep):
44
+ folder = Path(entry.strip('"'))
45
+ if not folder.is_absolute():
46
+ continue
47
+ for name in names:
48
+ candidate = folder / name
49
+ if candidate.is_file() and not candidate.resolve().is_relative_to(ROOT):
50
+ return str(candidate.resolve())
51
+ return None
52
+
53
+
54
+ def main():
55
+ folder = runtime_folder()
56
+ folder = folder.resolve() if folder is not None else None
57
+ # Commands act on this project, and its documented paths are relative to the root.
58
+ os.chdir(ROOT)
59
+ if folder is not None:
60
+ sys.path.insert(0, str(folder))
61
+ from orca_agent_workflow.cli import main as run
62
+
63
+ return run(sys.argv[1:])
64
+ try:
65
+ pin = json.loads((AGENTS / "workflow.json").read_text(encoding="utf-8"))["runtime"]
66
+ version = pin["version"]
67
+ except (OSError, ValueError, KeyError, TypeError):
68
+ print("workflow: .agents/workflow.json has no runtime version pin", file=sys.stderr)
69
+ return 1
70
+ uvx = find_uvx()
71
+ if uvx is None:
72
+ print(
73
+ "workflow: install uv (https://docs.astral.sh/uv/) or vendor the runtime with "
74
+ f"`uvx orca-agent-workflow@{version} init --vendor --apply`",
75
+ file=sys.stderr,
76
+ )
77
+ return 1
78
+ return subprocess.call([uvx, f"orca-agent-workflow@{version}", *sys.argv[1:]])
79
+
80
+
81
+ if __name__ == "__main__":
82
+ raise SystemExit(main())
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: project-handoff
3
+ description: Use the shared project-handoff workflow for this project.
4
+ ---
5
+
6
+ # Claude discovery adapter
7
+
8
+ Follow the shared project contract and canonical workflow:
9
+
10
+ @../../../.agents/skills/project-handoff/SKILL.md
11
+
12
+ This adapter changes discovery only; it grants no additional operations.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: review-pr
3
+ description: Use the shared review-pr workflow for this project.
4
+ ---
5
+
6
+ # Claude discovery adapter
7
+
8
+ Follow the shared project contract and canonical workflow:
9
+
10
+ @../../../.agents/skills/review-pr/SKILL.md
11
+
12
+ This adapter changes discovery only; it grants no additional operations.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: session-recover
3
+ description: Use the shared session-recover workflow for this project.
4
+ ---
5
+
6
+ # Claude discovery adapter
7
+
8
+ Follow the shared project contract and canonical workflow:
9
+
10
+ @../../../.agents/skills/session-recover/SKILL.md
11
+
12
+ This adapter changes discovery only; it grants no additional operations.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: spec-and-delegate
3
+ description: Use the shared spec-and-delegate workflow for this project.
4
+ ---
5
+
6
+ # Claude discovery adapter
7
+
8
+ Follow the shared project contract and canonical workflow:
9
+
10
+ @../../../.agents/skills/spec-and-delegate/SKILL.md
11
+
12
+ This adapter changes discovery only; it grants no additional operations.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: start-task
3
+ description: Coordinate substantive implementation tasks with this project's shared Orca workflow; skip questions, tiny edits and assigned worker/reviewer jobs.
4
+ ---
5
+
6
+ # Claude discovery adapter
7
+
8
+ Follow the shared project contract and canonical workflow:
9
+
10
+ @../../../.agents/skills/start-task/SKILL.md
11
+
12
+ This adapter changes discovery only; it grants no additional operations.
@@ -0,0 +1,5 @@
1
+ # Orca agent workflow: keep its files LF on every platform, including Windows checkouts
2
+ .agents/** text eol=lf
3
+ .claude/** text eol=lf
4
+ .opencode/** text eol=lf
5
+ .githooks/** text eol=lf
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env sh
2
+ # Optional clone-wide protection, including human pushes. Install after bootstrap:
3
+ # git config core.hooksPath .githooks
4
+ while read -r local_ref local_oid remote_ref remote_oid; do
5
+ case "$remote_ref" in
6
+ refs/heads/main|refs/heads/master)
7
+ echo "Protected branch: push a feature branch and merge through review." >&2
8
+ exit 1
9
+ ;;
10
+ esac
11
+ done
@@ -0,0 +1,3 @@
1
+ # Orca agent workflow
2
+ .tmp/
3
+ .agents/runtime/**/__pycache__/
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Use the shared project-handoff workflow.
3
+ ---
4
+
5
+ Read `AGENTS.md` and `.agents/skills/project-handoff/SKILL.md`, then follow that canonical
6
+ workflow. This command routes instructions only; it does not qualify OpenCode for
7
+ confined worker execution or expand the user's task permissions.
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Use the shared review-pr workflow.
3
+ ---
4
+
5
+ Read `AGENTS.md` and `.agents/skills/review-pr/SKILL.md`, then follow that canonical
6
+ workflow. This command routes instructions only; it does not qualify OpenCode for
7
+ confined worker execution or expand the user's task permissions.
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Use the shared session-recover workflow.
3
+ ---
4
+
5
+ Read `AGENTS.md` and `.agents/skills/session-recover/SKILL.md`, then follow that canonical
6
+ workflow. This command routes instructions only; it does not qualify OpenCode for
7
+ confined worker execution or expand the user's task permissions.
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Use the shared spec-and-delegate workflow.
3
+ ---
4
+
5
+ Read `AGENTS.md` and `.agents/skills/spec-and-delegate/SKILL.md`, then follow that canonical
6
+ workflow. This command routes instructions only; it does not qualify OpenCode for
7
+ confined worker execution or expand the user's task permissions.