trustship 0.1.0__tar.gz

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 (72) hide show
  1. trustship-0.1.0/LICENSE +21 -0
  2. trustship-0.1.0/PKG-INFO +190 -0
  3. trustship-0.1.0/README.md +176 -0
  4. trustship-0.1.0/pyproject.toml +33 -0
  5. trustship-0.1.0/setup.cfg +4 -0
  6. trustship-0.1.0/src/trustship/__init__.py +3 -0
  7. trustship-0.1.0/src/trustship/__main__.py +3 -0
  8. trustship-0.1.0/src/trustship/adoption.py +33 -0
  9. trustship-0.1.0/src/trustship/check_sync.py +167 -0
  10. trustship-0.1.0/src/trustship/cli.py +88 -0
  11. trustship-0.1.0/src/trustship/codex_review.py +506 -0
  12. trustship-0.1.0/src/trustship/decision_brief.py +1195 -0
  13. trustship-0.1.0/src/trustship/doctor.py +46 -0
  14. trustship-0.1.0/src/trustship/eval_review.py +1777 -0
  15. trustship-0.1.0/src/trustship/executables.py +159 -0
  16. trustship-0.1.0/src/trustship/gate-node.Dockerfile +25 -0
  17. trustship-0.1.0/src/trustship/gate-python-deps.Dockerfile +20 -0
  18. trustship-0.1.0/src/trustship/gate.Dockerfile +9 -0
  19. trustship-0.1.0/src/trustship/gemini_review.py +539 -0
  20. trustship-0.1.0/src/trustship/install.py +535 -0
  21. trustship-0.1.0/src/trustship/migrate.py +403 -0
  22. trustship-0.1.0/src/trustship/native.py +196 -0
  23. trustship-0.1.0/src/trustship/orca_client.py +113 -0
  24. trustship-0.1.0/src/trustship/policy.py +205 -0
  25. trustship-0.1.0/src/trustship/providers.py +259 -0
  26. trustship-0.1.0/src/trustship/resume_dispatch.py +163 -0
  27. trustship-0.1.0/src/trustship/review.py +1531 -0
  28. trustship-0.1.0/src/trustship/review_gate.py +634 -0
  29. trustship-0.1.0/src/trustship/run_gates.py +607 -0
  30. trustship-0.1.0/src/trustship/sandbox_worker.py +831 -0
  31. trustship-0.1.0/src/trustship/sensitive.json +19 -0
  32. trustship-0.1.0/src/trustship/start.py +349 -0
  33. trustship-0.1.0/src/trustship/task_plan.py +769 -0
  34. trustship-0.1.0/src/trustship/task_scope.py +1797 -0
  35. trustship-0.1.0/src/trustship/template/AGENTS.md +49 -0
  36. trustship-0.1.0/src/trustship/template/CLAUDE.md +4 -0
  37. trustship-0.1.0/src/trustship/template/agents/LICENSE +21 -0
  38. trustship-0.1.0/src/trustship/template/agents/README.md +62 -0
  39. trustship-0.1.0/src/trustship/template/agents/WORKFLOW.md +73 -0
  40. trustship-0.1.0/src/trustship/template/agents/docs/cross-provider.md +79 -0
  41. trustship-0.1.0/src/trustship/template/agents/docs/roles/implementer.md +15 -0
  42. trustship-0.1.0/src/trustship/template/agents/docs/task-permissions.md +124 -0
  43. trustship-0.1.0/src/trustship/template/agents/skills/project-handoff/SKILL.md +23 -0
  44. trustship-0.1.0/src/trustship/template/agents/skills/review-pr/SKILL.md +41 -0
  45. trustship-0.1.0/src/trustship/template/agents/skills/review-pr/references/record.example.json +31 -0
  46. trustship-0.1.0/src/trustship/template/agents/skills/review-pr/references/reviewer.md +20 -0
  47. trustship-0.1.0/src/trustship/template/agents/skills/session-recover/SKILL.md +17 -0
  48. trustship-0.1.0/src/trustship/template/agents/skills/session-recover/references/recovery.md +38 -0
  49. trustship-0.1.0/src/trustship/template/agents/skills/session-recover/scripts/session_context.py +246 -0
  50. trustship-0.1.0/src/trustship/template/agents/skills/spec-and-delegate/SKILL.md +45 -0
  51. trustship-0.1.0/src/trustship/template/agents/skills/spec-and-delegate/references/spec-template.md +53 -0
  52. trustship-0.1.0/src/trustship/template/agents/skills/start-task/SKILL.md +72 -0
  53. trustship-0.1.0/src/trustship/template/agents/workflow.json +64 -0
  54. trustship-0.1.0/src/trustship/template/agents/workflow.py +146 -0
  55. trustship-0.1.0/src/trustship/template/claude/skills/project-handoff/SKILL.md +12 -0
  56. trustship-0.1.0/src/trustship/template/claude/skills/review-pr/SKILL.md +12 -0
  57. trustship-0.1.0/src/trustship/template/claude/skills/session-recover/SKILL.md +12 -0
  58. trustship-0.1.0/src/trustship/template/claude/skills/spec-and-delegate/SKILL.md +12 -0
  59. trustship-0.1.0/src/trustship/template/claude/skills/start-task/SKILL.md +12 -0
  60. trustship-0.1.0/src/trustship/template/gitattributes +5 -0
  61. trustship-0.1.0/src/trustship/template/githooks/pre-push +11 -0
  62. trustship-0.1.0/src/trustship/template/gitignore +3 -0
  63. trustship-0.1.0/src/trustship/template/opencode/commands/project-handoff.md +7 -0
  64. trustship-0.1.0/src/trustship/template/opencode/commands/review-pr.md +7 -0
  65. trustship-0.1.0/src/trustship/template/opencode/commands/session-recover.md +7 -0
  66. trustship-0.1.0/src/trustship/template/opencode/commands/spec-and-delegate.md +7 -0
  67. trustship-0.1.0/src/trustship/template/opencode/commands/start-task.md +9 -0
  68. trustship-0.1.0/src/trustship.egg-info/PKG-INFO +190 -0
  69. trustship-0.1.0/src/trustship.egg-info/SOURCES.txt +70 -0
  70. trustship-0.1.0/src/trustship.egg-info/dependency_links.txt +1 -0
  71. trustship-0.1.0/src/trustship.egg-info/entry_points.txt +2 -0
  72. trustship-0.1.0/src/trustship.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Diar Sabri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: trustship
3
+ Version: 0.1.0
4
+ Summary: Base-anchored offline gates, independent cross-provider review, and sandboxed workflows for AI coding agents.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/diarsabri/trustship
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Topic :: Software Development :: Quality Assurance
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # TrustShip
16
+
17
+ **A structured, guardrailed workflow for building software with Claude Code, Codex, Gemini CLI, and Antigravity—works standalone via `uvx` on any Git repo, or with [Orca](https://github.com/stablyai/orca) for multi-worktree orchestration.**
18
+
19
+ ```mermaid
20
+ flowchart LR
21
+ P[Planner / Coordinator] --> S[Approved committed spec]
22
+ S --> I[Scoped implementer]
23
+ I --> G[Isolated Docker checks]
24
+ G --> R[Fresh cross-provider review]
25
+ R --> H[Human merge]
26
+ ```
27
+
28
+ You describe a task, approve a concrete plan, and review the resulting PR. Orca manages isolated Git worktrees and agent sessions; this kit adds shared instructions, **6 skills**, and a zero-dependency Python runtime (`trustship`) for file-scoped delegation, offline container checks, revision-bound review verification, and session recovery.
29
+
30
+ ---
31
+
32
+ ## How a task works
33
+
34
+ Suppose you ask, **“Show a weekly total in my habit tracker.”**
35
+
36
+ 1. **Agree on what done looks like.** Your coordinator clarifies edge cases (e.g., Monday start, zero for an empty week), writes down an Intent & Invariant spec (objective, acceptance criteria, invariants, and verification commands), and gets your approval.
37
+ 2. **Build inside an explicit sandbox.** Orca gives the task its own worktree. A credential-scrubbed `sandbox-worker` (Claude or Codex) implements and iterates against local tests, or an opt-in Claude file-only broker restricts edits to exact approved paths.
38
+ 3. **Verify in isolation and get a fresh reading.** Checks run in a clean, offline Docker container (`--network=none`, no host env) using built-in `stdlib`, `python-deps`, or `node` presets (or your own Dockerfile). A fresh reviewer from a different provider (Claude, Codex, or Gemini CLI) checks the complete diff against the spec and test evidence.
39
+ 4. **Decide whether to merge.** You get the PR, exact checks run, reviewer findings, and an optional `decision-brief` summarizing open risks—and you make the merge decision.
40
+
41
+ ### Five failure modes it prevents
42
+
43
+ - **Branches weakening their own rules** — Policy and gate Dockerfiles are read from the reviewed base commit (`git show <base>:.agents/workflow.json`), never the working tree.
44
+ - **Implementers leaking secrets or wandering out of scope** — `sandbox-worker` strips host credentials before running local test loops, and the opt-in Claude file broker serves approved file tools only (no shell, network, or commits).
45
+ - **Host-only test passes** — `gate` streams a clean Git snapshot into a disposable offline Docker container.
46
+ - **Stale or incomplete AI reviews** — `review-gate` rejects stale commit SHAs, silent model fallbacks, self-review, or unreviewed sensitive files.
47
+ - **Duplicate writers on retry or handoff** — Non-retrying launch receipts and model-free transcript inspection (`session-recover`) prevent overlapping writers.
48
+
49
+ ---
50
+
51
+ ## The 6 skills at a glance
52
+
53
+ One standalone skill handles adoption; **5 workflow skills** live inside your repository under `.agents/skills/` with thin discovery wrappers for Claude Code (`.claude/skills/`) and optionally OpenCode (`.opencode/commands/`).
54
+
55
+ | Skill | Where it lives | What it does |
56
+ | --- | --- | --- |
57
+ | **`setup-trustship`** | Kit repo / Skills CLI (not copied by `init`) | Bootstraps Orca, previews/applies `init`, merges existing instructions, configures checks, and verifies adoption. |
58
+ | **`start-task`** | `.agents/skills/start-task/` | Default coordinator intake. Routes substantive work from discovery through review while keeping questions and tiny edits lightweight. |
59
+ | **`spec-and-delegate`** | `.agents/skills/spec-and-delegate/` | Turns a settled design into a user-approved, committed spec under `specs/` and delegates bounded file-only edits. |
60
+ | **`review-pr`** | `.agents/skills/review-pr/` | Arranges a fresh, read-only review of the complete `base..head` diff and validates evidence via `review-gate`. |
61
+ | **`project-handoff`** | `.agents/skills/project-handoff/` | Saves a curated checkpoint under `docs/handovers/` and transfers an active task cleanly between clients. |
62
+ | **`session-recover`** | `.agents/skills/session-recover/` | Reads local Claude/Codex JSONL transcripts without model calls and verifies writer exit before taking over a stalled session. |
63
+
64
+ Read the [complete skills guide](docs/skills.md) for triggers, inputs/outputs, bundled scripts, and lifecycle flow.
65
+
66
+ ---
67
+
68
+ ## What gets added to your repository
69
+
70
+ Running `init --apply` installs **27 files** by default—zero runtime code, and nothing under `README.md`, `LICENSE`, `docs/`, `tests/`, or `specs/`. Existing files are never overwritten; conflicts are staged under `.tmp/trustship/merge/`.
71
+
72
+ ```text
73
+ your-repo/
74
+ ├── AGENTS.md # Shared contract + default routing to start-task
75
+ ├── CLAUDE.md # Thin Claude entry point (@AGENTS.md)
76
+ ├── .gitignore # Appends .tmp/ and runtime __pycache__/ rules
77
+ ├── .gitattributes # Enforces LF line endings on workflow files
78
+ ├── .agents/
79
+ │ ├── workflow.json # Single config: checks, roles/models, gates, runtime pin
80
+ │ ├── workflow.py # Pinned launcher (runs via uvx or vendored runtime)
81
+ │ ├── README.md # Day-to-day workflow guide for your contributors
82
+ │ ├── WORKFLOW.md # End-to-end execution runbook
83
+ │ ├── LICENSE # Kit MIT notice (keeps your repo LICENSE untouched)
84
+ │ ├── docs/ # Permission runbook, cross-provider rules, implementer prompt
85
+ │ └── skills/ # 5 canonical workflow skills + templates + recovery script
86
+ └── .claude/
87
+ └── skills/ # 5 thin Claude discovery wrappers pointing to .agents/skills/
88
+ ```
89
+
90
+ **Optional flags:** `--minimal` installs only **3 paths** (`.agents/workflow.json`, `AGENTS.md`, `.gitignore`) for per-user plugin/skill installs (`.claude-plugin/` and `.codex-plugin/`), `--opencode` adds 5 OpenCode command adapters (`.opencode/commands/`), `--pre-push-hook` adds `.githooks/pre-push` (opt-in protected-branch guard), and `--vendor` copies the Python runtime into `.agents/runtime/` (+62 files) so you don't need `uvx` or PyPI at run time.
91
+
92
+ See [installed files & CLI reference](docs/installed-files.md) for a file-by-file breakdown and all 18 `.agents/workflow.py` commands.
93
+
94
+ ---
95
+
96
+ ## Quick start
97
+
98
+ ### Option 1: Try standalone checks & review with zero committed files (no Orca required)
99
+
100
+ Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/). Run base-trusted offline Docker checks or a fresh read-only review on **any plain Git repository** without committing any workflow files:
101
+
102
+ ```sh
103
+ # Offline Docker checks using committed dependency manifests from main
104
+ uvx trustship@0.1.0 gate --base main --preset python-deps --cmd "pytest"
105
+
106
+ # Fresh read-only diff review + automatic review-gate validation (--dry-run previews with 0 model calls)
107
+ uvx trustship@0.1.0 review --base main --reviewer claude:claude-opus-5-5 --dry-run
108
+
109
+ # Benchmark a reviewer against labeled synthetic diffs, or generate an advisory decision brief
110
+ uvx trustship@0.1.0 eval-review --dry-run
111
+ uvx trustship@0.1.0 decision-brief --base main
112
+ ```
113
+
114
+ ### Option 2: Adopt the full workflow in a repository (CLI preview/apply)
115
+
116
+ `init` previews by default and only writes with `--apply`:
117
+
118
+ ```sh
119
+ uvx trustship@0.1.0 init --target ./my-project
120
+ uvx trustship@0.1.0 init --target ./my-project --apply
121
+ ```
122
+
123
+ ### Option 3: Let your coding agent set it up
124
+
125
+ Open your project in **Claude Code, Codex, or OpenCode** and paste:
126
+
127
+ ```text
128
+ Set up https://github.com/diarsabri/trustship in this project.
129
+ Follow INSTALL.md, install Orca if needed, preserve my existing work,
130
+ and show me what you verified.
131
+ ```
132
+
133
+ Prefer installing the setup skill explicitly? Run `npx skills add diarsabri/trustship --skill setup-trustship --copy`.
134
+
135
+ ### Option 4: Try the mechanics offline (no model account or Orca needed)
136
+
137
+ ```sh
138
+ git clone https://github.com/diarsabri/trustship
139
+ cd trustship
140
+ python3 examples/offline_demo.py
141
+ python3 -m unittest discover -s tests -q
142
+ ```
143
+
144
+ The offline demo creates a disposable repo, enforces allowed vs. denied file reads/writes, and exercises `review-gate` against policy tampering, stale commits, silent model fallback, and self-review — with zero model calls:
145
+
146
+ ```text
147
+ [scope] Unlisted read (private.txt): DENIED
148
+ [scope] Protected control write (.agents/workflow.json): DENIED
149
+ [scope] Approved edit (docs/guide.md) -> frozen review manifest: PASS
150
+ [review-gate] Branch-tampered policy digest (vs git show <base>:): REJECTED
151
+ [review-gate] Stale review after new commit: REJECTED
152
+ [review-gate] Silent model fallback (requested != effective): REJECTED
153
+ [review-gate] Self-review by implementer session: REJECTED
154
+ [review-gate] Fresh revision-bound review record: PASS
155
+ Model calls: 0. Independent model review: not run.
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Provider & platform support
161
+
162
+ | Surface | Status | Notes |
163
+ | --- | --- | --- |
164
+ | **Planner / Coordinator** | Claude Code or Codex | Configured in `.agents/workflow.json` with exact model IDs. Opt-in experimental Gemini 4 Neon planner via Antigravity (`agy`). |
165
+ | **Implementer** | Sandboxed native worker (`sandbox-worker`) or Claude file-only broker | Lightweight Intent & Invariant specs run via `sandbox-worker` (scrubbed env, full test loop); opt-in `--confinement file-broker` uses the Claude MCP broker. |
166
+ | **Independent Reviewer** | Claude Code, Codex (opt-in), or Gemini CLI (opt-in) | Codex (`codex-review qualify`, macOS/Linux) and Gemini CLI (`gemini-review qualify`, macOS/Linux/Windows) unlock cross-family review. |
167
+ | **OpenCode** | Setup & shared instructions | Confined worker dispatch is not qualified. |
168
+ | **Checks & OS** | macOS, Linux, Windows (native) | Docker runs offline gates with built-in `stdlib`, `python-deps`, and `node` presets (or custom Dockerfiles); `native-check` supports Apple/Xcode host tests on macOS. |
169
+
170
+ ---
171
+
172
+ ## Documentation
173
+
174
+ Browse the [documentation index](docs/README.md) or jump directly to:
175
+
176
+ | Document | What it covers |
177
+ | --- | --- |
178
+ | [docs/getting-started.md](docs/getting-started.md) | Walk through your first task from setup to human merge. |
179
+ | [docs/setup-reference.md](docs/setup-reference.md) | Detailed setup, Orca bootstrap, manual CLI flags, Antigravity planner handoff, `native-check`, and `migrate`. |
180
+ | [docs/skills.md](docs/skills.md) | Detailed breakdown of all 6 skills: triggers, inputs, outputs, references, and bundled scripts. |
181
+ | [docs/installed-files.md](docs/installed-files.md) | Exact 27-file layout (and 3-path `--minimal` mode), optional flags (`--minimal`, `--opencode`, `--pre-push-hook`, `--vendor`), merge rules, and all 18 CLI commands. |
182
+ | [docs/architecture.md](docs/architecture.md) | System design, base-commit policy trust anchor, 3-revision model, runtime pinning, and package module map. |
183
+ | [docs/security.md](docs/security.md) | Confinement boundaries, POSIX/Windows broker mechanics, Docker gate isolation, and explicit threat-model non-goals. |
184
+ | [docs/compatibility.md](docs/compatibility.md) | Supported clients, Antigravity planner limits, OS/Windows caveats, and qualification requirements. |
185
+ | [docs/validation.md](docs/validation.md) | Automated checks, Docker self-tests, CI matrix, and historical validation log. |
186
+ | [INSTALL.md](INSTALL.md) | Machine-readable entry point followed by coding agents during automated setup. |
187
+
188
+ ---
189
+
190
+ See [CONTRIBUTING.md](CONTRIBUTING.md). [MIT licensed](LICENSE). Independent project by Diar Sabri, built for use with separately installed [Orca](https://github.com/stablyai/orca) and coding-agent CLIs. No affiliation or endorsement is implied.
@@ -0,0 +1,176 @@
1
+ # TrustShip
2
+
3
+ **A structured, guardrailed workflow for building software with Claude Code, Codex, Gemini CLI, and Antigravity—works standalone via `uvx` on any Git repo, or with [Orca](https://github.com/stablyai/orca) for multi-worktree orchestration.**
4
+
5
+ ```mermaid
6
+ flowchart LR
7
+ P[Planner / Coordinator] --> S[Approved committed spec]
8
+ S --> I[Scoped implementer]
9
+ I --> G[Isolated Docker checks]
10
+ G --> R[Fresh cross-provider review]
11
+ R --> H[Human merge]
12
+ ```
13
+
14
+ You describe a task, approve a concrete plan, and review the resulting PR. Orca manages isolated Git worktrees and agent sessions; this kit adds shared instructions, **6 skills**, and a zero-dependency Python runtime (`trustship`) for file-scoped delegation, offline container checks, revision-bound review verification, and session recovery.
15
+
16
+ ---
17
+
18
+ ## How a task works
19
+
20
+ Suppose you ask, **“Show a weekly total in my habit tracker.”**
21
+
22
+ 1. **Agree on what done looks like.** Your coordinator clarifies edge cases (e.g., Monday start, zero for an empty week), writes down an Intent & Invariant spec (objective, acceptance criteria, invariants, and verification commands), and gets your approval.
23
+ 2. **Build inside an explicit sandbox.** Orca gives the task its own worktree. A credential-scrubbed `sandbox-worker` (Claude or Codex) implements and iterates against local tests, or an opt-in Claude file-only broker restricts edits to exact approved paths.
24
+ 3. **Verify in isolation and get a fresh reading.** Checks run in a clean, offline Docker container (`--network=none`, no host env) using built-in `stdlib`, `python-deps`, or `node` presets (or your own Dockerfile). A fresh reviewer from a different provider (Claude, Codex, or Gemini CLI) checks the complete diff against the spec and test evidence.
25
+ 4. **Decide whether to merge.** You get the PR, exact checks run, reviewer findings, and an optional `decision-brief` summarizing open risks—and you make the merge decision.
26
+
27
+ ### Five failure modes it prevents
28
+
29
+ - **Branches weakening their own rules** — Policy and gate Dockerfiles are read from the reviewed base commit (`git show <base>:.agents/workflow.json`), never the working tree.
30
+ - **Implementers leaking secrets or wandering out of scope** — `sandbox-worker` strips host credentials before running local test loops, and the opt-in Claude file broker serves approved file tools only (no shell, network, or commits).
31
+ - **Host-only test passes** — `gate` streams a clean Git snapshot into a disposable offline Docker container.
32
+ - **Stale or incomplete AI reviews** — `review-gate` rejects stale commit SHAs, silent model fallbacks, self-review, or unreviewed sensitive files.
33
+ - **Duplicate writers on retry or handoff** — Non-retrying launch receipts and model-free transcript inspection (`session-recover`) prevent overlapping writers.
34
+
35
+ ---
36
+
37
+ ## The 6 skills at a glance
38
+
39
+ One standalone skill handles adoption; **5 workflow skills** live inside your repository under `.agents/skills/` with thin discovery wrappers for Claude Code (`.claude/skills/`) and optionally OpenCode (`.opencode/commands/`).
40
+
41
+ | Skill | Where it lives | What it does |
42
+ | --- | --- | --- |
43
+ | **`setup-trustship`** | Kit repo / Skills CLI (not copied by `init`) | Bootstraps Orca, previews/applies `init`, merges existing instructions, configures checks, and verifies adoption. |
44
+ | **`start-task`** | `.agents/skills/start-task/` | Default coordinator intake. Routes substantive work from discovery through review while keeping questions and tiny edits lightweight. |
45
+ | **`spec-and-delegate`** | `.agents/skills/spec-and-delegate/` | Turns a settled design into a user-approved, committed spec under `specs/` and delegates bounded file-only edits. |
46
+ | **`review-pr`** | `.agents/skills/review-pr/` | Arranges a fresh, read-only review of the complete `base..head` diff and validates evidence via `review-gate`. |
47
+ | **`project-handoff`** | `.agents/skills/project-handoff/` | Saves a curated checkpoint under `docs/handovers/` and transfers an active task cleanly between clients. |
48
+ | **`session-recover`** | `.agents/skills/session-recover/` | Reads local Claude/Codex JSONL transcripts without model calls and verifies writer exit before taking over a stalled session. |
49
+
50
+ Read the [complete skills guide](docs/skills.md) for triggers, inputs/outputs, bundled scripts, and lifecycle flow.
51
+
52
+ ---
53
+
54
+ ## What gets added to your repository
55
+
56
+ Running `init --apply` installs **27 files** by default—zero runtime code, and nothing under `README.md`, `LICENSE`, `docs/`, `tests/`, or `specs/`. Existing files are never overwritten; conflicts are staged under `.tmp/trustship/merge/`.
57
+
58
+ ```text
59
+ your-repo/
60
+ ├── AGENTS.md # Shared contract + default routing to start-task
61
+ ├── CLAUDE.md # Thin Claude entry point (@AGENTS.md)
62
+ ├── .gitignore # Appends .tmp/ and runtime __pycache__/ rules
63
+ ├── .gitattributes # Enforces LF line endings on workflow files
64
+ ├── .agents/
65
+ │ ├── workflow.json # Single config: checks, roles/models, gates, runtime pin
66
+ │ ├── workflow.py # Pinned launcher (runs via uvx or vendored runtime)
67
+ │ ├── README.md # Day-to-day workflow guide for your contributors
68
+ │ ├── WORKFLOW.md # End-to-end execution runbook
69
+ │ ├── LICENSE # Kit MIT notice (keeps your repo LICENSE untouched)
70
+ │ ├── docs/ # Permission runbook, cross-provider rules, implementer prompt
71
+ │ └── skills/ # 5 canonical workflow skills + templates + recovery script
72
+ └── .claude/
73
+ └── skills/ # 5 thin Claude discovery wrappers pointing to .agents/skills/
74
+ ```
75
+
76
+ **Optional flags:** `--minimal` installs only **3 paths** (`.agents/workflow.json`, `AGENTS.md`, `.gitignore`) for per-user plugin/skill installs (`.claude-plugin/` and `.codex-plugin/`), `--opencode` adds 5 OpenCode command adapters (`.opencode/commands/`), `--pre-push-hook` adds `.githooks/pre-push` (opt-in protected-branch guard), and `--vendor` copies the Python runtime into `.agents/runtime/` (+62 files) so you don't need `uvx` or PyPI at run time.
77
+
78
+ See [installed files & CLI reference](docs/installed-files.md) for a file-by-file breakdown and all 18 `.agents/workflow.py` commands.
79
+
80
+ ---
81
+
82
+ ## Quick start
83
+
84
+ ### Option 1: Try standalone checks & review with zero committed files (no Orca required)
85
+
86
+ Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/). Run base-trusted offline Docker checks or a fresh read-only review on **any plain Git repository** without committing any workflow files:
87
+
88
+ ```sh
89
+ # Offline Docker checks using committed dependency manifests from main
90
+ uvx trustship@0.1.0 gate --base main --preset python-deps --cmd "pytest"
91
+
92
+ # Fresh read-only diff review + automatic review-gate validation (--dry-run previews with 0 model calls)
93
+ uvx trustship@0.1.0 review --base main --reviewer claude:claude-opus-5-5 --dry-run
94
+
95
+ # Benchmark a reviewer against labeled synthetic diffs, or generate an advisory decision brief
96
+ uvx trustship@0.1.0 eval-review --dry-run
97
+ uvx trustship@0.1.0 decision-brief --base main
98
+ ```
99
+
100
+ ### Option 2: Adopt the full workflow in a repository (CLI preview/apply)
101
+
102
+ `init` previews by default and only writes with `--apply`:
103
+
104
+ ```sh
105
+ uvx trustship@0.1.0 init --target ./my-project
106
+ uvx trustship@0.1.0 init --target ./my-project --apply
107
+ ```
108
+
109
+ ### Option 3: Let your coding agent set it up
110
+
111
+ Open your project in **Claude Code, Codex, or OpenCode** and paste:
112
+
113
+ ```text
114
+ Set up https://github.com/diarsabri/trustship in this project.
115
+ Follow INSTALL.md, install Orca if needed, preserve my existing work,
116
+ and show me what you verified.
117
+ ```
118
+
119
+ Prefer installing the setup skill explicitly? Run `npx skills add diarsabri/trustship --skill setup-trustship --copy`.
120
+
121
+ ### Option 4: Try the mechanics offline (no model account or Orca needed)
122
+
123
+ ```sh
124
+ git clone https://github.com/diarsabri/trustship
125
+ cd trustship
126
+ python3 examples/offline_demo.py
127
+ python3 -m unittest discover -s tests -q
128
+ ```
129
+
130
+ The offline demo creates a disposable repo, enforces allowed vs. denied file reads/writes, and exercises `review-gate` against policy tampering, stale commits, silent model fallback, and self-review — with zero model calls:
131
+
132
+ ```text
133
+ [scope] Unlisted read (private.txt): DENIED
134
+ [scope] Protected control write (.agents/workflow.json): DENIED
135
+ [scope] Approved edit (docs/guide.md) -> frozen review manifest: PASS
136
+ [review-gate] Branch-tampered policy digest (vs git show <base>:): REJECTED
137
+ [review-gate] Stale review after new commit: REJECTED
138
+ [review-gate] Silent model fallback (requested != effective): REJECTED
139
+ [review-gate] Self-review by implementer session: REJECTED
140
+ [review-gate] Fresh revision-bound review record: PASS
141
+ Model calls: 0. Independent model review: not run.
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Provider & platform support
147
+
148
+ | Surface | Status | Notes |
149
+ | --- | --- | --- |
150
+ | **Planner / Coordinator** | Claude Code or Codex | Configured in `.agents/workflow.json` with exact model IDs. Opt-in experimental Gemini 4 Neon planner via Antigravity (`agy`). |
151
+ | **Implementer** | Sandboxed native worker (`sandbox-worker`) or Claude file-only broker | Lightweight Intent & Invariant specs run via `sandbox-worker` (scrubbed env, full test loop); opt-in `--confinement file-broker` uses the Claude MCP broker. |
152
+ | **Independent Reviewer** | Claude Code, Codex (opt-in), or Gemini CLI (opt-in) | Codex (`codex-review qualify`, macOS/Linux) and Gemini CLI (`gemini-review qualify`, macOS/Linux/Windows) unlock cross-family review. |
153
+ | **OpenCode** | Setup & shared instructions | Confined worker dispatch is not qualified. |
154
+ | **Checks & OS** | macOS, Linux, Windows (native) | Docker runs offline gates with built-in `stdlib`, `python-deps`, and `node` presets (or custom Dockerfiles); `native-check` supports Apple/Xcode host tests on macOS. |
155
+
156
+ ---
157
+
158
+ ## Documentation
159
+
160
+ Browse the [documentation index](docs/README.md) or jump directly to:
161
+
162
+ | Document | What it covers |
163
+ | --- | --- |
164
+ | [docs/getting-started.md](docs/getting-started.md) | Walk through your first task from setup to human merge. |
165
+ | [docs/setup-reference.md](docs/setup-reference.md) | Detailed setup, Orca bootstrap, manual CLI flags, Antigravity planner handoff, `native-check`, and `migrate`. |
166
+ | [docs/skills.md](docs/skills.md) | Detailed breakdown of all 6 skills: triggers, inputs, outputs, references, and bundled scripts. |
167
+ | [docs/installed-files.md](docs/installed-files.md) | Exact 27-file layout (and 3-path `--minimal` mode), optional flags (`--minimal`, `--opencode`, `--pre-push-hook`, `--vendor`), merge rules, and all 18 CLI commands. |
168
+ | [docs/architecture.md](docs/architecture.md) | System design, base-commit policy trust anchor, 3-revision model, runtime pinning, and package module map. |
169
+ | [docs/security.md](docs/security.md) | Confinement boundaries, POSIX/Windows broker mechanics, Docker gate isolation, and explicit threat-model non-goals. |
170
+ | [docs/compatibility.md](docs/compatibility.md) | Supported clients, Antigravity planner limits, OS/Windows caveats, and qualification requirements. |
171
+ | [docs/validation.md](docs/validation.md) | Automated checks, Docker self-tests, CI matrix, and historical validation log. |
172
+ | [INSTALL.md](INSTALL.md) | Machine-readable entry point followed by coding agents during automated setup. |
173
+
174
+ ---
175
+
176
+ See [CONTRIBUTING.md](CONTRIBUTING.md). [MIT licensed](LICENSE). Independent project by Diar Sabri, built for use with separately installed [Orca](https://github.com/stablyai/orca) and coding-agent CLIs. No affiliation or endorsement is implied.
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"] # PEP 639 license fields
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trustship"
7
+ dynamic = ["version"]
8
+ description = "Base-anchored offline gates, independent cross-provider review, and sandboxed workflows for AI coding agents."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ dependencies = []
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ "Topic :: Software Development :: Quality Assurance",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://github.com/diarsabri/trustship"
22
+
23
+ [project.scripts]
24
+ trustship = "trustship.cli:main"
25
+
26
+ [tool.setuptools.dynamic]
27
+ version = {attr = "trustship.__version__"}
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+
32
+ [tool.setuptools.package-data]
33
+ trustship = ["*.json", "*.Dockerfile", "template/**/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """TrustShip: scoped workers, independent review and gates for coding agents."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from trustship.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,33 @@
1
+ """Describe the local Git revisions used at the first project handoff."""
2
+
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ from trustship import task_scope
7
+
8
+
9
+ def revisions(root: Path) -> dict[str, str]:
10
+ def git_text(*args: str) -> str:
11
+ try:
12
+ return task_scope.git_bytes(root, *args).decode().strip()
13
+ except (subprocess.CalledProcessError, FileNotFoundError):
14
+ return ""
15
+
16
+ def policy(commit: str) -> str:
17
+ if not commit:
18
+ return "unresolved"
19
+ entry = git_text("ls-tree", commit, "--", task_scope.CONFIG)
20
+ return f"{commit} (policy {'present' if entry else 'unavailable'})"
21
+
22
+ head = gate = worker = default_ref = ""
23
+ if (root / ".git").exists():
24
+ head = git_text("rev-parse", "--verify", "HEAD^{commit}")
25
+ default_ref = git_text("symbolic-ref", "--quiet", "refs/remotes/origin/HEAD")
26
+ if default_ref:
27
+ gate = git_text("rev-parse", "--verify", default_ref + "^{commit}")
28
+ worker = git_text("merge-base", "HEAD", "origin/HEAD")
29
+ return {
30
+ "workspace (committed HEAD)": policy(head),
31
+ "gate (origin default branch)": policy(gate) if default_ref else "origin/HEAD unavailable",
32
+ "worker (merge base with origin/HEAD)": policy(worker) if default_ref else "origin/HEAD unavailable",
33
+ }
@@ -0,0 +1,167 @@
1
+ #!/usr/bin/env python3
2
+ """Check the project's workflow contract without calling a model or changing settings."""
3
+
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ from trustship import __version__, providers, task_scope
8
+
9
+
10
+ def _read_text(path: Path) -> str | None:
11
+ if not path.is_file():
12
+ return None
13
+ try:
14
+ return path.read_text(encoding="utf-8")
15
+ except (OSError, UnicodeDecodeError):
16
+ return None
17
+
18
+
19
+ def check(root: Path) -> list[str]:
20
+ problems = []
21
+ try:
22
+ config = task_scope.load_config((root / task_scope.CONFIG).read_bytes())
23
+ policy = task_scope.roles_policy(config)
24
+ pinned = config["runtime"].get("version")
25
+ if config["runtime"].get("package") != "trustship" or not pinned:
26
+ problems.append("runtime must pin an trustship version")
27
+ elif pinned != __version__:
28
+ problems.append(f"Runtime {__version__} differs from the pinned {pinned}")
29
+ install_mode = config["runtime"].get("install_mode", "full")
30
+ if install_mode not in ("full", "minimal"):
31
+ problems.append('runtime.install_mode must be "full" or "minimal"')
32
+ checks = config["project"].get("checks", [])
33
+ if not isinstance(checks, list) or any(
34
+ not isinstance(command, str) or not command.strip() for command in checks
35
+ ):
36
+ problems.append("project.checks must be a list of non-empty commands")
37
+ if policy.get("reviewer_provider_differs_from_planner") != "preferred":
38
+ problems.append('reviewer_provider_differs_from_planner must be "preferred"')
39
+ for role in ("planner", "implementer", "reviewer"):
40
+ profiles = policy.get("roles", {}).get(role)
41
+ if not isinstance(profiles, list):
42
+ problems.append(f"Missing role: {role}")
43
+ continue
44
+ for profile in profiles:
45
+ if not isinstance(profile, dict):
46
+ problems.append(f"Invalid {role} profile: expected an object")
47
+ continue
48
+ if profile.get("enabled") is not True:
49
+ if (
50
+ role == "implementer"
51
+ and profile.get("agent") != "claude"
52
+ and profile.get("enabled")
53
+ ):
54
+ problems.append(
55
+ "Only the qualified Claude file-only implementer is supported"
56
+ )
57
+ continue
58
+ agent = profile.get("agent")
59
+ model = profile.get("model")
60
+ adapter = providers.get_provider(agent)
61
+ if adapter is not None and not adapter.supports_role(role):
62
+ if adapter.name == "antigravity":
63
+ problems.append(
64
+ f"Antigravity supports planning only and cannot be an enabled {role}"
65
+ )
66
+ continue
67
+ if role == "implementer":
68
+ if not adapter.supports_model(model):
69
+ problems.append(f"Enabled {role} requires an exact model ID")
70
+ problems.append(
71
+ "Only the qualified Claude file-only implementer is supported"
72
+ )
73
+ continue
74
+ problems.append(f"Provider {adapter.name!r} does not support role {role!r}")
75
+ continue
76
+ if not providers.exact_model(agent, model, role=role):
77
+ problems.append(f"Enabled {role} requires an exact model ID")
78
+ if role == "implementer" and adapter is None:
79
+ problems.append("Only the qualified Claude file-only implementer is supported")
80
+ if install_mode == "minimal":
81
+ agents_md = root / "AGENTS.md"
82
+ if not agents_md.is_file():
83
+ problems.append("Missing workflow file: AGENTS.md")
84
+ else:
85
+ agents_text = _read_text(agents_md)
86
+ if agents_text is None or (
87
+ ".agents/workflow.json" not in agents_text
88
+ and "trustship" not in agents_text
89
+ ):
90
+ problems.append(
91
+ "AGENTS.md must reference the workflow contract "
92
+ "(.agents/workflow.json or trustship)"
93
+ )
94
+ return problems
95
+ if install_mode != "full":
96
+ return problems
97
+ skills = (
98
+ "start-task",
99
+ "spec-and-delegate",
100
+ "review-pr",
101
+ "project-handoff",
102
+ "session-recover",
103
+ )
104
+ for skill in skills:
105
+ canonical = root / f".agents/skills/{skill}/SKILL.md"
106
+ adapter = root / f".claude/skills/{skill}/SKILL.md"
107
+ command = root / f".opencode/commands/{skill}.md"
108
+ if not canonical.is_file():
109
+ problems.append(f"Missing shared skill: {skill}")
110
+ adapter_text = _read_text(adapter)
111
+ if adapter_text is None or f".agents/skills/{skill}/SKILL.md" not in adapter_text:
112
+ problems.append(f"Claude adapter drift: {skill}")
113
+ # OpenCode commands are optional; once installed they must stay thin.
114
+ if (root / ".opencode/commands").is_dir():
115
+ command_text = _read_text(command)
116
+ if command_text is None or f".agents/skills/{skill}/SKILL.md" not in command_text:
117
+ problems.append(f"OpenCode command drift: {skill}")
118
+ agents_md = root / "AGENTS.md"
119
+ if not agents_md.is_file():
120
+ problems.append("Missing workflow file: AGENTS.md")
121
+ else:
122
+ agents_text = _read_text(agents_md)
123
+ if agents_text is None or ".agents/skills/start-task/SKILL.md" not in agents_text:
124
+ problems.append(
125
+ "AGENTS.md must route substantive tasks to the shared start-task skill"
126
+ )
127
+ claude_md = root / "CLAUDE.md"
128
+ if not claude_md.is_file():
129
+ problems.append("Missing workflow file: CLAUDE.md")
130
+ else:
131
+ claude_text = _read_text(claude_md)
132
+ if claude_text is None or "@AGENTS.md" not in claude_text:
133
+ problems.append("CLAUDE.md must import the shared contract")
134
+ for path in (
135
+ ".agents/workflow.py",
136
+ ".agents/WORKFLOW.md",
137
+ ".agents/docs/roles/implementer.md",
138
+ ".agents/skills/spec-and-delegate/references/spec-template.md",
139
+ ):
140
+ if not (root / path).is_file():
141
+ problems.append(f"Missing workflow file: {path}")
142
+ except (OSError, ValueError, KeyError, TypeError) as exc:
143
+ problems.append(f"Invalid workflow configuration: {exc}")
144
+ return problems
145
+
146
+
147
+ def main() -> int:
148
+ root = task_scope.project_folder()
149
+ problems = check(root)
150
+ for problem in problems:
151
+ print("workflow-check: " + problem, file=sys.stderr)
152
+ if not problems:
153
+ mode = "full"
154
+ try:
155
+ config = task_scope.load_config((root / task_scope.CONFIG).read_bytes())
156
+ mode = config["runtime"].get("install_mode", "full")
157
+ except (OSError, ValueError, KeyError, TypeError):
158
+ pass
159
+ if mode == "minimal":
160
+ print("workflow-check: OK (minimal mode: shared contract and roles)")
161
+ else:
162
+ print("workflow-check: OK (shared contract, roles, and thin adapters)")
163
+ return int(bool(problems))
164
+
165
+
166
+ if __name__ == "__main__":
167
+ raise SystemExit(main())