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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Bug report
description: Something failed, blocked, or behaved unexpectedly
labels: [bug]
body:
- type: input
id: version
attributes:
label: TORQ version
placeholder: "torq --version, e.g. 0.2.0"
validations:
required: true
- type: dropdown
id: platform
attributes:
label: Platform
options: [Windows, Linux, macOS]
validations:
required: true
- type: textarea
id: repro
attributes:
label: Command and output
description: Exact command run and the JSON output (redact credential material)
render: console
validations:
required: true
- type: textarea
id: expected
attributes:
label: What you expected
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security vulnerability
url: https://github.com/pilotwaffle/torq-cli-python/security/advisories/new
about: Please report security issues privately per SECURITY.md
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Feature request
description: Propose a capability or an improvement
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: Problem you are trying to solve
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed behavior
validations:
required: true
- type: textarea
id: safety
attributes:
label: Safety / governance implications
description: TORQ fails closed by design. Does this change what is attested, contained, or evidenced?
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ this file is the canonical cumulative record.

## [Unreleased]

Nothing yet. Everything below is part of the unreleased 0.2.0 candidate.
### Added
- `torq demo`: zero-configuration dry-run trial. Scaffolds a valid run identity
and attestation documents from the packaged registry and policy, optionally
executes a real dry-run (`--run`), and leaves a verifiable run directory.
No provider is contacted.

### Changed
- README rewritten around the visitor: pitch, comparison table, quickstart,
real command transcript, platform-support matrix, and links to the threat
model and roadmap.
- Community onboarding: GitHub issue templates (bug, feature, security
contact link) and ROADMAP.md.


## [0.2.0] — unreleased candidate (release-preparation changes)

Expand Down
173 changes: 84 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,88 @@
[![CI](https://github.com/pilotwaffle/torq-cli-python/actions/workflows/ci.yml/badge.svg)](https://github.com/pilotwaffle/torq-cli-python/actions/workflows/ci.yml)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
[![Python 3.11–3.13](https://img.shields.io/badge/python-3.11--3.13-blue.svg)](pyproject.toml)

# TORQ CLI

TORQ CLI 0.2.0 is a standalone Python 3.11–3.13 governed agent runner. It validates immutable role profiles, connects providers through fail-closed adapters, runs provider processes under OS-enforced containment, records tamper-resistant evidence, and exposes an evidence-backed Fleet control and attended chat surface.

```text
torq profile validate --config PATH
torq status --offline --config PATH [--require-effective]
torq status --config PATH --require-effective --runtime ATTESTATION.json
torq config import-v5-normalized --config ABSOLUTE_PATH
torq config import-v5-console --config ABSOLUTE_PATH
torq auth status --credential-file E:\TORQ-CONSOLE\.env
torq auth store --provider deepseek --credential-ref credref_<32-lowercase-hex>
torq auth verify-access --provider deepseek --credential-ref credref_<32-lowercase-hex>
torq auth revoke --provider deepseek --credential-ref credref_<32-lowercase-hex>
torq auth store --provider deepseek --credential-ref credref_<32-lowercase-hex> --backend headless_encrypted_file --store-root ABSOLUTE_PATH
torq harness inspect --expected PROFILE.json --actual LIVE.json
torq setup --config .torq/config.yaml --answers examples/torq-v5-6-live.answers.json --credential-file E:\TORQ-CONSOLE\.env
torq run --goal "..." --run-root RUNS --identity ID.json --expected PROFILE.json --actual LIVE.json
torq run --goal "..." --run-root RUNS --identity ID.json --expected PROFILE.json --actual LIVE.json --config .torq/config.yaml --live --allow-live --policy-allow-live
torq evidence verify --run-root RUN_DIRECTORY
torq fleet --run-root RUN_DIRECTORY --serve
torq fleet --run-root RUN_DIRECTORY --serve --chat-provider deepseek --chat-model deepseek-v4-pro --credential-file ABSOLUTE_ENV_PATH
torq trust readiness
torq --version
**A governed agent runner: every run is attested, dry-run by default, and backed by verifiable evidence.**

TORQ executes multi-stage agent plans (design → review → build → adversarial audit) inside a governed boundary. It validates the machine and role profile before any provider is touched, refuses live execution unless both the operator and the policy opt in, never lets an agent commit, push, or merge, and writes a tamper-evident receipt chain for every run.

## Why TORQ

| | TORQ | Typical agent CLI |
|---|---|---|
| Default mode | Dry-run plan, zero provider calls | Live execution |
| Going live | Requires `--allow-live` **and** `--policy-allow-live` | One flag, if that |
| Your worktree | Untouched until an audited, tree-pinned proposal is approved | Agent edits freely |
| Evidence | Per-run receipt chain; `torq evidence verify` | None |
| Credentials | Opaque handles in the OS keychain; attended entry only | Plaintext env files |
| Provider containment | OS-owned processes (Windows production; Linux/macOS fail closed) | Whatever the provider does |

## Quickstart

Requires Python 3.11–3.13.

```bash
pip install torq-cli # or: pip install git+https://github.com/pilotwaffle/torq-cli-python
torq demo --goal "Add input validation to the login form" --run
torq evidence verify --run-root ./torq-demo-runs/<run-id>
```

`torq demo` scaffolds the identity and attestation documents, runs a real four-stage dry-run (G1D → G1R → Builder → G2A), and leaves a verifiable run directory behind. No provider is contacted and nothing outside the run root is written. The full install matrix is in [docs/install.md](docs/install.md).

## What it looks like

```console
$ torq --version
torq 0.2.0

$ torq demo --goal "Add input validation to the login form" --run
{"status": "scaffolded", "inputs_dir": "torq-demo-runs/demo-inputs", ...}
{"status": "dry_run_complete", "report": {"mode": "dry_run", "verdict": "dry_run_complete",
"planned_roles": ["g1d", "g1r", "builder", "g2a", "refine_bug", "refine_ui"],
"attested": true, "receipts": "torq-demo-runs/run-0d04c989291241d58830a964ce578fc9", ...}}

$ torq evidence verify --run-root torq-demo-runs/run-0d04c989291241d58830a964ce578fc9
{"finding": null, "status": "verified"}
```

Dry-run is the default. Live execution requires both `--allow-live` and `--policy-allow-live`. Agents never commit, push, or merge. The primary worktree remains unchanged until an audited, tree-pinned proposal receives explicit approval.

`torq run` invokes the governed orchestration boundary. Dry-run records the
four-stage plan without provider calls. An injected dispatcher remains available
for embedding and tests. The installed live command loads the validated saved
config, resolves its explicit credential source, and constructs the persistent
entitlement ledger before executing G1D -> G1R -> Builder -> G2A. It routes
HIGH defects through the bound repair lane, and performs a targeted G2A
re-audit before returning `awaiting_approval`. Invalid config, credentials,
regional routing, or missing transport binaries fail before a run directory is
created. See `docs/architecture/governed-orchestration.md`.

Process-backed Claude-compatible live stages use the owned-process boundary and
are production-enabled only on Windows. Linux refuses them with
`distinct_identity_system_broker_required`; macOS refuses them with
`owned_process_strong_containment_unavailable`. OpenAI's direct HTTPS adapter
does not launch a provider process and does not inherit ambient proxy settings.

The T-06A import command reads only the authenticated normalized V5 fixture shape and emits a fixed registry-authoritative stdout projection. It does not read raw Console configuration, write files, resolve credentials, access providers, or claim T-06/Phase 1 completion.

The T-06C Console import command accepts the bounded raw Console V5 YAML shape and emits the same canonical `torq-v5-repo-compat` v1 projection without manual translation. It is read-only: it does not discover a default Console path, write configuration, copy endpoints or wrapper names, resolve credentials, or access providers.

`status --offline` is intentionally `offline_unattested`; effective status requires a runtime attestation. Installation instructions are in `docs/install.md`, and the security/threat model is in `SECURITY.md`.

The optional `--credential-file` compatibility source reuses an explicit
external provider env file without copying its values into TORQ configuration.
For the Console harness it maps `QWEN_TOKEN_PLAN_API_KEY` (which covers both
the Qwen and DeepSeek lanes, since both bill to one Alibaba Token Plan),
`KIMI_CODE_API_KEY` (falling back to `KIMI_API_KEY`), and `GLM_API_KEY` into
isolated Claude-compatible child environments. See
`docs/external-credential-source.md`.
External env files are accepted only when already owner-only: POSIX mode `0600`
or a Windows DACL containing only the owner. TORQ does not repair a permissive
secret file. Token Plan routing accepts only the canonical
`https://token-plan.<region>.maas.aliyuncs.com/apps/anthropic` shape, with no
userinfo, query, or fragment.

Native provider credentials are stored through `keyring` 25.7 in the current
user's Windows Credential Manager, macOS Keychain, or Linux Secret Service.
`auth store` accepts the value only from an attended no-echo terminal and
refuses redirected input. Configuration contains only opaque
`credref_<32-lowercase-hex>` handles. `auth verify-access` deliberately resolves
the selected record inside TORQ but emits only coarse success/failure state; it
does not call a provider or print the value. The attended headless encrypted-
file backend is implemented with an explicit absolute `--store-root`. It uses a
no-echo passphrase prompt and never acts as an automatic fallback.

Fleet chat currently accepts direct-provider credentials only from an explicit
absolute `--credential-file`; it does not resolve the configured platform or
headless vault. The browser receives neither credentials nor process handles.
Windows is the only production governed-chat platform: Job Objects own and
confirm termination of the provider tree. Linux fails closed with
`distinct_identity_system_broker_required`; its per-user systemd/cgroup-v2
adapter is experimental evidence only. macOS fails closed with
`owned_process_strong_containment_unavailable` pending a separately signed and
notarized native containment product.

Local signing and the same-volume manifest anchor are tamper-resistant, not
production-trust hardened. `torq trust readiness` reports
`production_signing_identity_exportable` and
`production_receipt_anchor_not_independent` until a non-exportable platform
signer and independently operated remote transparency service are integrated.

Local mock/conformance results do not prove provider effectiveness, hosted
multi-OS CI, clean-machine installation, branch protection, or release
readiness. The v0.2.0 candidate requires fresh protected-main CI and release
evidence; this source tree does not claim those gates have run.
<!-- TODO: record a 30–60s asciinema of `torq demo --run` + `torq evidence verify` and embed it here -->

## Command surface

| Command | What it does |
|---|---|
| `torq demo` | Zero-config dry-run trial: scaffolds identity + attestation, optionally executes. |
| `torq run` | The governed orchestration boundary. Dry-run by default; live needs `--allow-live` and `--policy-allow-live`. |
| `torq evidence verify --run-root DIR` | Verify a run's receipt chain and artifacts. |
| `torq fleet --run-root DIR --serve` | Evidence-backed Fleet control surface with attended chat. |
| `torq setup` / `torq auth` | Interactive config; credentials stored as opaque handles in the OS keychain or an attended encrypted file vault. |
| `torq status` / `torq profile validate` / `torq harness inspect` | Attest the machine, the role profile, and the live harness before a run. |
| `torq config import-v5-*` | Import normalized or raw Console V5 configuration (read-only projection). |
| `torq trust readiness` | Report production-trust gaps (signing identity, receipt anchor). |

## Safety model

- Agents never commit, push, or merge. The worktree stays unchanged until an audited, tree-pinned proposal receives explicit approval.
- Dry-run is the default. Provider processes only run under OS-enforced containment, and only on platforms where that containment is production-grade.
- Configuration stores `credref_<hex>` handles, never secrets. Secret entry is attended and no-echo; permissive secret files are refused, not repaired.
- Fail closed: invalid config, credentials, regional routing, or missing transport binaries stop the run before a run directory is created.

Full threat model: [SECURITY.md](SECURITY.md) and [docs/security/threat-model.md](docs/security/threat-model.md).

## Platform support

| | Dry-run + evidence | Live provider containment |
|---|---|---|
| Windows | ✅ | ✅ production (Job Objects) |
| Linux | ✅ | Fails closed; systemd/cgroup-v2 adapter is experimental |
| macOS | ✅ | Fails closed pending a signed, notarized containment product |

## Status

Local signing and the same-volume manifest anchor are tamper-resistant, not production-trust hardened — `torq trust readiness` reports the gap explicitly. See [ROADMAP.md](ROADMAP.md) for what closes it.

## Contributing and license

[CONTRIBUTING.md](CONTRIBUTING.md) · [CHANGELOG.md](CHANGELOG.md) · Apache-2.0
22 changes: 22 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Roadmap

## Now — v0.2.0 hardening
- Fresh protected-`main` CI and clean-machine install evidence on Windows, Linux, and macOS.
- Publish to PyPI under the settled package name.
- User-facing release notes and a recorded demo of `torq demo --run` + `torq evidence verify`.

## Next
- Production trust hardening: non-exportable platform signing identity and an
independently operated remote transparency anchor for receipts
(`torq trust readiness` reports both gaps today).
- Linux governed containment: mature the experimental systemd/cgroup-v2 adapter
from evidence-grade to production-grade.
- macOS governed containment: separately signed and notarized containment product.
- Hosted docs site generated from `docs/`.

## Later
- Formal V6 contract publication, MMH consensus, and remote receipt anchoring.
- Provider pricing tables and richer Fleet analytics.

Non-goals are stable: TORQ agents never commit, push, or merge; live execution
always requires operator and policy double opt-in; evidence stays verifiable offline.
Loading
Loading