orch-code 0.1.1
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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +624 -0
- package/cmd/apply.go +111 -0
- package/cmd/auth.go +393 -0
- package/cmd/auth_test.go +100 -0
- package/cmd/diff.go +57 -0
- package/cmd/doctor.go +149 -0
- package/cmd/explain.go +192 -0
- package/cmd/explain_test.go +62 -0
- package/cmd/init.go +100 -0
- package/cmd/interactive.go +1372 -0
- package/cmd/interactive_input.go +45 -0
- package/cmd/interactive_input_test.go +55 -0
- package/cmd/logs.go +72 -0
- package/cmd/model.go +84 -0
- package/cmd/plan.go +149 -0
- package/cmd/provider.go +189 -0
- package/cmd/provider_model_doctor_test.go +91 -0
- package/cmd/root.go +67 -0
- package/cmd/run.go +123 -0
- package/cmd/run_engine.go +208 -0
- package/cmd/run_engine_test.go +30 -0
- package/cmd/session.go +589 -0
- package/cmd/session_helpers.go +54 -0
- package/cmd/session_integration_test.go +30 -0
- package/cmd/session_list_current_test.go +87 -0
- package/cmd/session_messages_test.go +163 -0
- package/cmd/session_runs_test.go +68 -0
- package/cmd/sprint1_integration_test.go +119 -0
- package/cmd/stats.go +173 -0
- package/cmd/stats_test.go +71 -0
- package/cmd/version.go +4 -0
- package/go.mod +45 -0
- package/go.sum +108 -0
- package/internal/agents/agent.go +31 -0
- package/internal/agents/coder.go +167 -0
- package/internal/agents/planner.go +155 -0
- package/internal/agents/reviewer.go +118 -0
- package/internal/agents/runtime.go +25 -0
- package/internal/agents/runtime_test.go +77 -0
- package/internal/auth/account.go +78 -0
- package/internal/auth/oauth.go +523 -0
- package/internal/auth/store.go +287 -0
- package/internal/confidence/policy.go +174 -0
- package/internal/confidence/policy_test.go +71 -0
- package/internal/confidence/scorer.go +253 -0
- package/internal/confidence/scorer_test.go +83 -0
- package/internal/config/config.go +331 -0
- package/internal/config/config_defaults_test.go +138 -0
- package/internal/execution/contract_builder.go +160 -0
- package/internal/execution/contract_builder_test.go +68 -0
- package/internal/execution/plan_compliance.go +161 -0
- package/internal/execution/plan_compliance_test.go +71 -0
- package/internal/execution/retry_directive.go +132 -0
- package/internal/execution/scope_guard.go +69 -0
- package/internal/logger/logger.go +120 -0
- package/internal/models/contracts_test.go +100 -0
- package/internal/models/models.go +269 -0
- package/internal/orchestrator/orchestrator.go +701 -0
- package/internal/orchestrator/orchestrator_retry_test.go +135 -0
- package/internal/orchestrator/review_engine_test.go +50 -0
- package/internal/orchestrator/state.go +42 -0
- package/internal/orchestrator/test_classifier_test.go +68 -0
- package/internal/patch/applier.go +131 -0
- package/internal/patch/applier_test.go +25 -0
- package/internal/patch/parser.go +89 -0
- package/internal/patch/patch.go +60 -0
- package/internal/patch/summary.go +30 -0
- package/internal/patch/validator.go +104 -0
- package/internal/planning/normalizer.go +416 -0
- package/internal/planning/normalizer_test.go +64 -0
- package/internal/providers/errors.go +35 -0
- package/internal/providers/openai/client.go +498 -0
- package/internal/providers/openai/client_test.go +187 -0
- package/internal/providers/provider.go +47 -0
- package/internal/providers/registry.go +32 -0
- package/internal/providers/registry_test.go +57 -0
- package/internal/providers/router.go +52 -0
- package/internal/providers/state.go +114 -0
- package/internal/providers/state_test.go +64 -0
- package/internal/repo/analyzer.go +188 -0
- package/internal/repo/context.go +83 -0
- package/internal/review/engine.go +267 -0
- package/internal/review/engine_test.go +103 -0
- package/internal/runstore/store.go +137 -0
- package/internal/runstore/store_test.go +59 -0
- package/internal/runtime/lock.go +150 -0
- package/internal/runtime/lock_test.go +57 -0
- package/internal/session/compaction.go +260 -0
- package/internal/session/compaction_test.go +36 -0
- package/internal/session/service.go +117 -0
- package/internal/session/service_test.go +113 -0
- package/internal/storage/storage.go +1498 -0
- package/internal/storage/storage_test.go +413 -0
- package/internal/testing/classifier.go +80 -0
- package/internal/testing/classifier_test.go +36 -0
- package/internal/tools/command.go +160 -0
- package/internal/tools/command_test.go +56 -0
- package/internal/tools/file.go +111 -0
- package/internal/tools/git.go +77 -0
- package/internal/tools/invalid_params_test.go +36 -0
- package/internal/tools/policy.go +98 -0
- package/internal/tools/policy_test.go +36 -0
- package/internal/tools/registry_test.go +52 -0
- package/internal/tools/result.go +30 -0
- package/internal/tools/search.go +86 -0
- package/internal/tools/tool.go +94 -0
- package/main.go +9 -0
- package/npm/orch.js +25 -0
- package/package.json +41 -0
- package/scripts/changelog.js +20 -0
- package/scripts/check-release-version.js +21 -0
- package/scripts/lib/release-utils.js +223 -0
- package/scripts/postinstall.js +157 -0
- package/scripts/release.js +52 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## v0.1.1 - 2026-04-03
|
|
6
|
+
|
|
7
|
+
- No user-facing changes recorded.
|
|
8
|
+
## v0.1.0 - 2026-04-03
|
|
9
|
+
|
|
10
|
+
- Add npm wrapper install flow for the Go-based `orch` binary.
|
|
11
|
+
- Add GoReleaser and GitHub Actions release automation for GitHub Releases and npm publish.
|
|
12
|
+
- Add release preparation helpers for version synchronization and tagging.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Furkan Beydemir
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
# Orch
|
|
2
|
+
|
|
3
|
+
[](https://go.dev/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
**Orch is a local-first control plane for deterministic AI coding.**
|
|
7
|
+
|
|
8
|
+
Instead of treating the model as the owner of the development workflow,
|
|
9
|
+
Orch treats the model as a **bounded execution engine** inside a runtime that Orch controls.
|
|
10
|
+
|
|
11
|
+
In one line:
|
|
12
|
+
|
|
13
|
+
> **Orch standardizes the coding workflow around the model, instead of trusting the model to invent the workflow.**
|
|
14
|
+
|
|
15
|
+
That means:
|
|
16
|
+
|
|
17
|
+
- **Orch owns planning**
|
|
18
|
+
- **Orch owns validation**
|
|
19
|
+
- **Orch owns testing**
|
|
20
|
+
- **Orch owns review**
|
|
21
|
+
- **Orch owns completion policy**
|
|
22
|
+
- **the LLM remains swappable**
|
|
23
|
+
|
|
24
|
+
Core pipeline:
|
|
25
|
+
|
|
26
|
+
`Task -> Task Brief -> Plan -> Execution Contract -> Code -> Validate -> Test -> Review -> Confidence -> Patch`
|
|
27
|
+
|
|
28
|
+
The goal is not “let the model do whatever it wants”.
|
|
29
|
+
The goal is to make AI coding **structured, auditable, fail-closed, and less model-fragile**.
|
|
30
|
+
|
|
31
|
+
### GitHub one-screen pitch
|
|
32
|
+
|
|
33
|
+
- **Structured planning before coding**
|
|
34
|
+
- **Explicit quality gates before completion**
|
|
35
|
+
- **Explainable runs with persisted artifacts**
|
|
36
|
+
|
|
37
|
+
### Why Orch?
|
|
38
|
+
|
|
39
|
+
Most AI coding tools still behave like this:
|
|
40
|
+
- the model decides the plan
|
|
41
|
+
- the model decides scope
|
|
42
|
+
- the model decides what to test
|
|
43
|
+
- the model decides whether the result is “good enough”
|
|
44
|
+
|
|
45
|
+
That creates inconsistent quality.
|
|
46
|
+
Different models, prompts, or context windows can produce very different behavior for the same task.
|
|
47
|
+
|
|
48
|
+
Orch exists to reduce that variance.
|
|
49
|
+
|
|
50
|
+
It pushes the workflow into a runtime with:
|
|
51
|
+
- structured artifacts
|
|
52
|
+
- named validation gates
|
|
53
|
+
- bounded retries
|
|
54
|
+
- review rubric enforcement
|
|
55
|
+
- confidence-based completion decisions
|
|
56
|
+
- persistent run history for audit and explanation
|
|
57
|
+
|
|
58
|
+
So the product promise is not “magic autonomous coding”.
|
|
59
|
+
It is **more disciplined AI coding with clearer quality control**.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Product Positioning
|
|
64
|
+
|
|
65
|
+
### Orch = control plane
|
|
66
|
+
|
|
67
|
+
Orch is responsible for:
|
|
68
|
+
- normalizing the task
|
|
69
|
+
- compiling a structured plan
|
|
70
|
+
- building an execution contract
|
|
71
|
+
- enforcing scope boundaries
|
|
72
|
+
- running validation gates
|
|
73
|
+
- running tests
|
|
74
|
+
- scoring review quality
|
|
75
|
+
- computing confidence
|
|
76
|
+
- deciding whether a run can complete
|
|
77
|
+
- persisting artifacts for audit and explanation
|
|
78
|
+
|
|
79
|
+
### LLM = replaceable execution engine
|
|
80
|
+
|
|
81
|
+
The model is responsible for:
|
|
82
|
+
- producing a patch inside Orch’s constraints
|
|
83
|
+
- responding to retry directives
|
|
84
|
+
- contributing review text signals
|
|
85
|
+
|
|
86
|
+
But the model is **not** the workflow owner.
|
|
87
|
+
|
|
88
|
+
That distinction is the whole product thesis.
|
|
89
|
+
|
|
90
|
+
### How Orch differs from agentic coding tools
|
|
91
|
+
|
|
92
|
+
| Topic | Typical agentic coding tool | Orch |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| Workflow owner | Usually the model | Orch runtime |
|
|
95
|
+
| Planning | Often prompt-shaped, model-led | Structured, Orch-owned artifact |
|
|
96
|
+
| Scope control | Soft guidance | Explicit execution contract + scope guard |
|
|
97
|
+
| Validation | Often ad hoc | Named validation gates |
|
|
98
|
+
| Testing | Best effort | Required test-stage gates |
|
|
99
|
+
| Review | Free-form model opinion | Rubric + Orch decision layer |
|
|
100
|
+
| Completion | “Patch exists” is often enough | Review + confidence policy must pass |
|
|
101
|
+
| Explainability | Mostly chat transcript | Persisted run artifacts + `orch explain` |
|
|
102
|
+
| Telemetry | Limited | `orch stats` over run artifacts |
|
|
103
|
+
| Model swap impact | Can significantly change behavior | Process stays more stable by design |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## What Orch Does Today
|
|
108
|
+
|
|
109
|
+
Current implemented foundations include:
|
|
110
|
+
|
|
111
|
+
- structured task brief generation
|
|
112
|
+
- structured planning
|
|
113
|
+
- `orch plan --json`
|
|
114
|
+
- execution contract generation
|
|
115
|
+
- scope guard / allowed-file enforcement
|
|
116
|
+
- patch hygiene + plan compliance validation
|
|
117
|
+
- test-stage gates
|
|
118
|
+
- review rubric engine
|
|
119
|
+
- confidence scoring
|
|
120
|
+
- confidence enforcement policy
|
|
121
|
+
- test failure classification
|
|
122
|
+
- bounded retry directives
|
|
123
|
+
- SQLite-backed project / session / run persistence
|
|
124
|
+
- explainability via `orch explain`
|
|
125
|
+
- telemetry via `orch stats`
|
|
126
|
+
|
|
127
|
+
This means Orch already behaves more like a **quality-enforcing runtime** than a simple prompt wrapper.
|
|
128
|
+
|
|
129
|
+
### Best fit for
|
|
130
|
+
|
|
131
|
+
Orch is a better fit when you want:
|
|
132
|
+
- a repeatable CLI workflow instead of agent improvisation
|
|
133
|
+
- explicit quality gates before completion
|
|
134
|
+
- persistent run artifacts for audit/debugging
|
|
135
|
+
- a system that can keep its process discipline even if the model changes
|
|
136
|
+
|
|
137
|
+
It is a worse fit if your main goal is fully free-form, conversational, unconstrained agent behavior.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## How Orch Works
|
|
142
|
+
|
|
143
|
+
A run is not considered successful just because a patch exists.
|
|
144
|
+
|
|
145
|
+
A healthy run should look like this:
|
|
146
|
+
|
|
147
|
+
1. Orch normalizes the task into a structured brief
|
|
148
|
+
2. Orch compiles a plan with acceptance criteria and constraints
|
|
149
|
+
3. Orch builds an execution contract for the coder
|
|
150
|
+
4. The coder produces a bounded patch
|
|
151
|
+
5. Orch validates patch integrity and scope compliance
|
|
152
|
+
6. Orch runs required tests
|
|
153
|
+
7. Orch evaluates the result with a review scorecard
|
|
154
|
+
8. Orch computes confidence from objective signals
|
|
155
|
+
9. Orch either:
|
|
156
|
+
- completes,
|
|
157
|
+
- requests revision, or
|
|
158
|
+
- fails closed
|
|
159
|
+
|
|
160
|
+
This is the core difference between Orch and “agent just edited some files”.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Key Concepts
|
|
165
|
+
|
|
166
|
+
### Structured planning
|
|
167
|
+
Orch generates and persists a structured `TaskBrief` and `Plan` instead of relying only on raw model text.
|
|
168
|
+
|
|
169
|
+
### Execution contract
|
|
170
|
+
The coder works inside an explicit contract:
|
|
171
|
+
- allowed files
|
|
172
|
+
- inspect files
|
|
173
|
+
- required edits
|
|
174
|
+
- prohibited actions
|
|
175
|
+
- acceptance criteria
|
|
176
|
+
- invariants
|
|
177
|
+
- patch budget
|
|
178
|
+
|
|
179
|
+
### Validation gates
|
|
180
|
+
Each important quality check becomes a named gate, such as:
|
|
181
|
+
- `patch_parse_valid`
|
|
182
|
+
- `patch_hygiene`
|
|
183
|
+
- `scope_compliance`
|
|
184
|
+
- `plan_compliance`
|
|
185
|
+
- `required_tests_executed`
|
|
186
|
+
- `required_tests_passed`
|
|
187
|
+
- `review_scorecard_valid`
|
|
188
|
+
- `review_decision_threshold_met`
|
|
189
|
+
|
|
190
|
+
### Review rubric
|
|
191
|
+
Review is not just free-form commentary.
|
|
192
|
+
Orch computes a structured scorecard over:
|
|
193
|
+
- requirement coverage
|
|
194
|
+
- scope control
|
|
195
|
+
- regression risk
|
|
196
|
+
- readability
|
|
197
|
+
- maintainability
|
|
198
|
+
- test adequacy
|
|
199
|
+
|
|
200
|
+
### Confidence enforcement
|
|
201
|
+
Confidence is not only displayed.
|
|
202
|
+
It can actively affect completion behavior.
|
|
203
|
+
|
|
204
|
+
Default policy:
|
|
205
|
+
- `score >= 0.70` -> completion can proceed
|
|
206
|
+
- `0.50 <= score < 0.70` -> revise
|
|
207
|
+
- `score < 0.50` -> fail
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Installation
|
|
212
|
+
|
|
213
|
+
Global install via npm:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm i -g orch-code
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Installer behavior:
|
|
220
|
+
- first tries to download a prebuilt release binary for your platform
|
|
221
|
+
- falls back to `go build` if no release asset is available and Go is installed locally
|
|
222
|
+
|
|
223
|
+
Published release assets are expected to look like this:
|
|
224
|
+
- `orch-darwin-arm64`
|
|
225
|
+
- `orch-darwin-x64`
|
|
226
|
+
- `orch-linux-arm64`
|
|
227
|
+
- `orch-linux-x64`
|
|
228
|
+
- `orch-windows-arm64.exe`
|
|
229
|
+
- `orch-windows-x64.exe`
|
|
230
|
+
|
|
231
|
+
Requirements for source-build fallback:
|
|
232
|
+
- Go `1.25+`
|
|
233
|
+
|
|
234
|
+
Build:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
go build -o orch .
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Run without building:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
go run . <command>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Release Flow
|
|
247
|
+
|
|
248
|
+
`npm i -g orch-code` becomes zero-Go for end users once GitHub Releases and npm publish are both live.
|
|
249
|
+
|
|
250
|
+
Repo automation now expects:
|
|
251
|
+
- GitHub Actions secret: `NPM_TOKEN`
|
|
252
|
+
- a git tag in the form `vX.Y.Z`
|
|
253
|
+
- `package.json`, `package-lock.json`, and `cmd/version.go` to already match that version
|
|
254
|
+
|
|
255
|
+
Release steps:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# update versions first
|
|
259
|
+
npm run release:prepare -- 0.1.0
|
|
260
|
+
|
|
261
|
+
# or bump semver automatically
|
|
262
|
+
npm run release:patch
|
|
263
|
+
npm run release:minor
|
|
264
|
+
npm run release:major
|
|
265
|
+
|
|
266
|
+
# or also create the git tag locally
|
|
267
|
+
npm run release:prepare -- 0.1.0 --tag
|
|
268
|
+
|
|
269
|
+
# push when ready
|
|
270
|
+
git tag v0.1.0
|
|
271
|
+
git push origin v0.1.0
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The release workflow will:
|
|
275
|
+
- run `go test ./...`
|
|
276
|
+
- verify the tag matches package metadata
|
|
277
|
+
- build darwin/linux/windows binaries with GoReleaser
|
|
278
|
+
- publish a GitHub Release with raw binary assets
|
|
279
|
+
- publish the npm package
|
|
280
|
+
|
|
281
|
+
`release:prepare` updates these files together:
|
|
282
|
+
- `package.json`
|
|
283
|
+
- `package-lock.json`
|
|
284
|
+
- `cmd/version.go`
|
|
285
|
+
|
|
286
|
+
By default it also refreshes `CHANGELOG.md` from git commit subjects since the last tag.
|
|
287
|
+
|
|
288
|
+
If you prefer `make` targets:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
make release-patch
|
|
292
|
+
make release-minor
|
|
293
|
+
make release-major
|
|
294
|
+
make release-prepare VERSION=0.1.1
|
|
295
|
+
make release-prepare VERSION=0.1.1 TAG=--tag
|
|
296
|
+
make changelog VERSION=0.1.1
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Quick Start
|
|
302
|
+
|
|
303
|
+
Initialize Orch in a repository:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
./orch init
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Set up provider auth.
|
|
310
|
+
API key mode:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
export OPENAI_API_KEY="your_api_key"
|
|
314
|
+
./orch auth login openai --method api
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Or account mode (OAuth):
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
./orch auth login openai --method account --flow auto
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Validate runtime readiness:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
./orch doctor
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Generate a structured plan only:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
./orch plan "add redis caching to user service"
|
|
333
|
+
./orch plan "add redis caching to user service" --json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Run the full pipeline:
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
./orch run "add redis caching to user service"
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Explain the latest run:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
./orch explain
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Show quality stats across recent runs:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
./orch stats
|
|
352
|
+
./orch stats --limit 100
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Inspect and apply the latest patch:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
./orch diff
|
|
359
|
+
./orch apply
|
|
360
|
+
./orch apply --force --approve-destructive
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Interactive Mode
|
|
366
|
+
|
|
367
|
+
Start interactive mode:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
./orch
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Important behavior:
|
|
374
|
+
|
|
375
|
+
- **plain text goes to chat mode**
|
|
376
|
+
- **`/plan ...` runs structured planning**
|
|
377
|
+
- **`/run ...` runs the full pipeline**
|
|
378
|
+
|
|
379
|
+
So typing something like:
|
|
380
|
+
|
|
381
|
+
```text
|
|
382
|
+
selam
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
does **not** start the coding pipeline.
|
|
386
|
+
It is treated as chat.
|
|
387
|
+
|
|
388
|
+
Useful interactive commands:
|
|
389
|
+
|
|
390
|
+
```text
|
|
391
|
+
/help
|
|
392
|
+
/plan add health endpoint
|
|
393
|
+
/run fix auth timeout bug
|
|
394
|
+
/logs
|
|
395
|
+
/explain
|
|
396
|
+
/stats
|
|
397
|
+
/session current
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Command Surface
|
|
403
|
+
|
|
404
|
+
### Core workflow
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
./orch init
|
|
408
|
+
./orch plan "task"
|
|
409
|
+
./orch run "task"
|
|
410
|
+
./orch diff
|
|
411
|
+
./orch apply
|
|
412
|
+
./orch logs [run-id]
|
|
413
|
+
./orch explain [run-id]
|
|
414
|
+
./orch stats --limit 50
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Sessions
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
./orch session list
|
|
421
|
+
./orch session create feature-auth
|
|
422
|
+
./orch session create feature-auth --worktree-path ../orch-feature-auth
|
|
423
|
+
./orch session select feature-auth
|
|
424
|
+
./orch session current
|
|
425
|
+
./orch session runs feature-auth --status completed --contains auth --limit 20
|
|
426
|
+
./orch session close feature-auth
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Provider and auth
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
./orch auth login openai --method api
|
|
433
|
+
./orch auth login openai --method account --flow auto
|
|
434
|
+
./orch auth list
|
|
435
|
+
./orch auth status
|
|
436
|
+
./orch auth logout openai
|
|
437
|
+
./orch provider
|
|
438
|
+
./orch provider list
|
|
439
|
+
./orch provider list --json
|
|
440
|
+
./orch provider set openai
|
|
441
|
+
./orch model
|
|
442
|
+
./orch model set coder gpt-5.3-codex
|
|
443
|
+
./orch doctor
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## Persistence and Auditability
|
|
449
|
+
|
|
450
|
+
Orch persists runtime state under `.orch/`.
|
|
451
|
+
|
|
452
|
+
Important files:
|
|
453
|
+
- `.orch/config.json`
|
|
454
|
+
- `.orch/repo-map.json`
|
|
455
|
+
- `.orch/orch.db`
|
|
456
|
+
- `.orch/runs/<run-id>.state`
|
|
457
|
+
- `.orch/latest.patch`
|
|
458
|
+
- `.orch/latest-run-id`
|
|
459
|
+
|
|
460
|
+
Artifacts stored per run can include:
|
|
461
|
+
- task
|
|
462
|
+
- task brief
|
|
463
|
+
- plan
|
|
464
|
+
- execution contract
|
|
465
|
+
- patch
|
|
466
|
+
- validation results
|
|
467
|
+
- retry directive
|
|
468
|
+
- review result
|
|
469
|
+
- review scorecard
|
|
470
|
+
- confidence report
|
|
471
|
+
- test failure classifications
|
|
472
|
+
- logs
|
|
473
|
+
|
|
474
|
+
This persistence is what powers `orch explain` and `orch stats`.
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Safety and Quality Model
|
|
479
|
+
|
|
480
|
+
Orch is designed to be fail-closed by default.
|
|
481
|
+
|
|
482
|
+
Safety / quality behaviors include:
|
|
483
|
+
- read-only planning behavior
|
|
484
|
+
- destructive apply approval
|
|
485
|
+
- repository lock per execution root
|
|
486
|
+
- bounded retries
|
|
487
|
+
- structured validation gates
|
|
488
|
+
- explicit review decisioning
|
|
489
|
+
- confidence-based completion policy
|
|
490
|
+
|
|
491
|
+
Example `safety` config:
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"safety": {
|
|
496
|
+
"dryRun": true,
|
|
497
|
+
"requireDestructiveApproval": true,
|
|
498
|
+
"lockStaleAfterSeconds": 3600,
|
|
499
|
+
"retry": {
|
|
500
|
+
"validationMax": 2,
|
|
501
|
+
"testMax": 2,
|
|
502
|
+
"reviewMax": 2
|
|
503
|
+
},
|
|
504
|
+
"confidence": {
|
|
505
|
+
"completeMin": 0.70,
|
|
506
|
+
"failBelow": 0.50
|
|
507
|
+
},
|
|
508
|
+
"featureFlags": {
|
|
509
|
+
"permissionMode": true,
|
|
510
|
+
"repoLock": true,
|
|
511
|
+
"retryLimits": true,
|
|
512
|
+
"patchConflictReporting": true,
|
|
513
|
+
"confidenceEnforcement": true
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## Architecture
|
|
522
|
+
|
|
523
|
+
### Runtime at a glance
|
|
524
|
+
|
|
525
|
+
```text
|
|
526
|
+
User Task
|
|
527
|
+
|
|
|
528
|
+
v
|
|
529
|
+
Task Brief / Normalizer
|
|
530
|
+
|
|
|
531
|
+
v
|
|
532
|
+
Structured Plan
|
|
533
|
+
|
|
|
534
|
+
v
|
|
535
|
+
Execution Contract
|
|
536
|
+
|
|
|
537
|
+
v
|
|
538
|
+
LLM Worker (planner/coder/reviewer as bounded roles)
|
|
539
|
+
|
|
|
540
|
+
v
|
|
541
|
+
Validation Gates -> Test Gates -> Review Rubric -> Confidence Policy
|
|
542
|
+
|
|
|
543
|
+
v
|
|
544
|
+
Run Decision: complete / revise / fail
|
|
545
|
+
|
|
|
546
|
+
v
|
|
547
|
+
Persistence + Explainability + Telemetry
|
|
548
|
+
(.orch/orch.db, .orch/runs/*.state, orch explain, orch stats)
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
Main runtime areas:
|
|
552
|
+
|
|
553
|
+
- `cmd/` - CLI surface
|
|
554
|
+
- `internal/orchestrator/` - run state machine and pipeline enforcement
|
|
555
|
+
- `internal/planning/` - task normalization and structured planning helpers
|
|
556
|
+
- `internal/execution/` - execution contracts, scope guard, plan compliance, retry directives
|
|
557
|
+
- `internal/review/` - rubric-based review engine
|
|
558
|
+
- `internal/confidence/` - scoring and enforcement policy
|
|
559
|
+
- `internal/testing/` - test failure classification
|
|
560
|
+
- `internal/patch/` - patch parse, validate, apply
|
|
561
|
+
- `internal/tools/` - guarded tool execution policies
|
|
562
|
+
- `internal/storage/` - SQLite-backed persistence
|
|
563
|
+
- `internal/runstore/` - persisted run-state files for explainability/telemetry
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Product Direction
|
|
568
|
+
|
|
569
|
+
The long-term direction is:
|
|
570
|
+
|
|
571
|
+
> Orch should standardize the software delivery workflow around the model.
|
|
572
|
+
> The model should not define the workflow.
|
|
573
|
+
|
|
574
|
+
Put differently:
|
|
575
|
+
|
|
576
|
+
- Orch should own planning
|
|
577
|
+
- Orch should own validation
|
|
578
|
+
- Orch should own testing
|
|
579
|
+
- Orch should own review
|
|
580
|
+
- Orch should own completion policy
|
|
581
|
+
- the LLM should remain swappable
|
|
582
|
+
|
|
583
|
+
This is why the project is better described as:
|
|
584
|
+
|
|
585
|
+
**Control Plane for Deterministic AI Coding**
|
|
586
|
+
|
|
587
|
+
not simply “an AI coding agent”.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## Roadmap and Specs
|
|
592
|
+
|
|
593
|
+
Key docs:
|
|
594
|
+
- Product requirements: `docs/PRD.md`
|
|
595
|
+
- System roadmap: `docs/SYSTEMATIC_CODING_ROADMAP.md`
|
|
596
|
+
- Implementation tasks: `docs/IMPLEMENTATION_TASK_LIST.md`
|
|
597
|
+
- Quality system: `docs/QUALITY_SYSTEM_SPEC.md`
|
|
598
|
+
- Planning engine: `docs/PLANNING_ENGINE_SPEC.md`
|
|
599
|
+
- Execution contract: `docs/EXECUTION_CONTRACT_SPEC.md`
|
|
600
|
+
- Confidence policy: `docs/CONFIDENCE_ENFORCEMENT_POLICY.md`
|
|
601
|
+
- Explain command: `docs/EXPLAIN_COMMAND_SPEC.md`
|
|
602
|
+
- Stats command: `docs/STATS_COMMAND_SPEC.md`
|
|
603
|
+
- Progress log: `docs/IMPLEMENTATION_PROGRESS.md`
|
|
604
|
+
- Sprint board: `docs/SPRINT_BOARD_90_DAY_PLAN.md`
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## Development
|
|
609
|
+
|
|
610
|
+
Run tests:
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
go test ./...
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## Contributing
|
|
619
|
+
|
|
620
|
+
Please read `CONTRIBUTING.md` before opening a pull request.
|
|
621
|
+
|
|
622
|
+
## License
|
|
623
|
+
|
|
624
|
+
This project is licensed under the MIT License. See `LICENSE`.
|