Skip to content
Open
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
21 changes: 11 additions & 10 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Sahai
# Saihai

[English](README.md) | [日本語](README.ja.md)

Sahai は、プロンプトを実行権限として扱うのではなく、typed artifact、明示的な承認、durable state、監査可能な evidence を通じて AI エージェントの作業を実行するためのローカル orchestrator / organization runtime リポジトリです。
Saihai は、プロンプトを実行権限として扱うのではなく、typed artifact、明示的な承認、durable state、監査可能な evidence を通じて AI エージェントの作業を実行するためのローカル orchestrator / organization runtime リポジトリです。

このリポジトリには Agent-Teams-Viewer(ATV)由来のローカル status viewer も残っていますが、現在の主要な product surface は deterministic frontdoor、durable workflow run、制約された main-agent bridge、typed report / evidence gate です。pre-release の記録では、historical artifact や compatibility alias を指す際に ATV の名称が残っている場合があります。

Expand Down Expand Up @@ -43,7 +43,8 @@ daemon scheduling、tmux worker execution、package distribution、automatic pub

```sh
python3 scripts/setup_directory_paths.py --help
# Supply all nine required directory options, then validate the catalog.
# configuration guide に示す8個の directory option を指定してから catalog を
# 検証する。SAIHAI_ROOT の default は primary checkout。
python3 scripts/setup_directory_paths.py --check
```

Expand All @@ -64,7 +65,7 @@ setup command は非破壊的で、owner-only file を書き込みます。proce

| 機能 | 現在の挙動 |
|---|---|
| Prompt classification | `scripts/configure_organization.py classify` と `/api/decide` が作業を `fast``strict`、`maintenance` に分類する。どの mode でも適用される task record と Vault record が必要 |
| Prompt classification | `scripts/configure_organization.py classify` と `/api/decide` は、`fast` / `strict` の execution mode と、`enabled` / `disabled` / `maintenance` の organization state を別々に返す。どの mode / state でも適用される task record と Vault record が必要 |
| Workflow selection | `workflow_selector.py` が typed classification を active workflow template へ deterministic に対応付ける。raw prompt は selection authority にならない |
| Frontdoor proposal | prompt 起点の request は `proposed` または `waiting_human` まで進むか、`blocked` として fail closed する。`propose` は approved activation を生成せず、workflow run も作成しない |
| Approval | `approve` は proposal digest から導出した challenge を検証する。許可される activation source は `human_ui`、`manual_cli`、`orchestrator-start`、trusted execution principal は `human_operator`、`manual_operator`、`orchestrator_start`。narrow CLI の default は `human_operator` / `human-ui` / `local_ui` |
Expand Down Expand Up @@ -204,8 +205,8 @@ provider CLI の1回の実行は既定30分で、1秒から24時間まで設定
```sh
python3 scripts/configure_organization.py status
python3 scripts/configure_organization.py runtime-paths
python3 scripts/configure_organization.py classify --prompt "Review the latest forecast"
AGENT_ORG_MAINTENANCE=1 python3 scripts/configure_organization.py classify --prompt "Repair a hook"
python3 scripts/configure_organization.py classify --prompt "Review the latest forecast" --mode strict --organization-state enabled
python3 scripts/configure_organization.py classify --prompt "Repair a hook" --organization-state maintenance
python3 scripts/configure_organization.py validate-all
python3 scripts/configure_organization.py workflow-selector validate-contracts
python3 scripts/configure_organization.py workflow-frontdoor --help
Expand All @@ -215,7 +216,7 @@ python3 scripts/configure_organization.py workflow-frontdoor --help
|---|---|
| `status` | organization settings、role/policy count、repository root を JSON で出力する |
| `runtime-paths` | ITB runtime、workflow selector/frontdoor/server、operator CLI、registry mirror を検証する |
| `classify` | prompt を `fast`、`strict`、`maintenance` に分類する |
| `classify` | optional な `--mode {fast,strict}` と、独立した `--organization-state {enabled,disabled,maintenance}` control を使って prompt を分類する |
| `validate-all` | offline suite、contract validation、Python compile check を実行する |
| `workflow-selector` | workflow contract を検証し、deterministic selection と activation-envelope operation を行う |
| `workflow-frontdoor` | host-owned な frontdoor / recovery surface 全体を提供する |
Expand Down Expand Up @@ -269,15 +270,15 @@ Codex profile、必須のadministrator deployment、canary、worker policy-domai

### Scoped worker backend

live scoped-worker backend は、host operator が以下の asset を手動設定するまで fail closed します。Sahai は key や credential を生成しません。
live scoped-worker backend は、host operator が以下の asset を手動設定するまで fail closed します。Saihai は key や credential を生成しません。

executor implementationはshippedですが、live `managed_worker` claimはsuppressされています。Codex 0.144.1ではsame-rootfsなlocal `git push`の絶対拒否を証明できません。currentなworker commissioningはevidenceを記録できても、`commission-seal`が`worker_denial_facts_not_promotable`でfail closedします。currentな`external_mutation`、`git_commit`、`git_push`、`credential_access` factは`result=fail`でhost observationもinconclusiveです。特に`workspace_profile_and_network_disabled_not_same_rootfs_isolation`と`dedicated_auth_deny_configured_not_mechanically_proven`は機械的なdeny evidenceではなく、明示的なnon-claimです。active worker claimには別のisolated policy domainで得たevidenceが必要です。shipped local action gatewayにはそのdomainへのautomatic transportがないため、current releaseは自動接続済みのend-to-end worker systemではありません。

| Environment variable | 用途 |
|---|---|
| `SAIHAI_SCOPED_EXECUTOR_KEY_FILE` | regular、non-symlink、`0600` file に保存された32 bytes以上の capability HMAC key |
| `SAIHAI_SCOPED_WORKTREE_ROOT` | host が task/run-bound worktree path を導出する canonical root |
| `SAIHAI_SCOPED_REPO_ROOT` | host-owned absolute repository path。default は Sahai repository root |
| `SAIHAI_SCOPED_REPO_ROOT` | host-owned absolute repository path。default は Saihai repository root |
| `SAIHAI_SCOPED_CODEX_EXECUTABLE` | digest が work order と capability に bind される absolute pinned Codex CLI path。group/world-writable binary は拒否される |
| `SAIHAI_SCOPED_CODEX_HOME` | dedicated worker runtime/auth root。main-agent profile は継承しない |
| `SAIHAI_ENABLE_SCOPED_WORKER_LIVE=1` | 明示的な live-execution gate。未設定時は deterministic fake harness だけが利用可能 |
Expand Down Expand Up @@ -369,7 +370,7 @@ ITB session discovery は `~/.claude/state/itb` と `~/.codex/state/itb` を読
| `GET /api/org?session=<id>` | team role state、active task、busy count |
| `GET /api/role?session=<id>&role=<role_id>` | role metadata、inbox、latest report、provider evidence |
| `GET /api/config` | organization settings と role/policy index |
| `GET /api/decide?prompt=<text>` | `fast``strict`、`maintenance` classification |
| `GET /api/decide?prompt=<text>` | `fast` / `strict` mode と、独立した `enabled` / `disabled` / `maintenance` organization state を返す decision |
| `GET /api/workflow-runs?session=<id>&task=<id>&state=<state>` | thin read-only workflow-run summary |
| `GET /api/workflow-run?session=<id>&run=<id>` | work order、report、provider evidence、transition metadata |
| `GET /api/workflow-lock` | 設定済み orchestrator root ごとの global workflow-lock status |
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Sahai
# Saihai

[English](README.md) | [Japanese](README.ja.md)

Sahai is a local orchestrator and organization-runtime repository for running
Saihai is a local orchestrator and organization-runtime repository for running
AI-agent work through typed artifacts, explicit approval, durable state, and
auditable evidence instead of treating a prompt as execution authority.

Expand All @@ -12,7 +12,7 @@ deterministic frontdoor, durable workflow runs, the constrained main-agent
bridge, and typed report and evidence gates. Pre-release records may still use
the ATV name for historical artifacts and compatibility aliases.

Sahai uses only the Python 3.10+ standard library for normal operation. No
Saihai uses only the Python 3.10+ standard library for normal operation. No
`pip install` step is required.

## Release
Expand Down Expand Up @@ -85,7 +85,8 @@ Linked worktrees reuse the primary checkout's catalog.

```sh
python3 scripts/setup_directory_paths.py --help
# Supply all nine required directory options, then validate the catalog.
# Supply the eight directory options shown in the configuration guide, then
# validate the catalog. SAIHAI_ROOT defaults to the primary checkout.
python3 scripts/setup_directory_paths.py --check
```

Expand Down Expand Up @@ -115,7 +116,7 @@ for the complete path audit.

| Capability | Current behavior |
|---|---|
| Prompt classification | `scripts/configure_organization.py classify` and `/api/decide` classify work as `fast`, `strict`, or `maintenance`. Every mode still requires the applicable task and Vault records. |
| Prompt classification | `scripts/configure_organization.py classify` and `/api/decide` report a `fast` or `strict` execution mode separately from the `enabled`, `disabled`, or `maintenance` organization state. Every mode and state still requires the applicable task and Vault records. |
| Workflow selection | `workflow_selector.py` deterministically maps a typed classification to an active workflow template. A raw prompt is never selection authority. |
| Frontdoor proposal | Prompt-originated requests stop at `proposed` or `waiting_human`, or fail closed as `blocked`. `propose` cannot produce an approved activation or create a workflow run. |
| Approval | `approve` verifies a challenge derived from the proposal digest. Accepted activation sources are `human_ui`, `manual_cli`, and `orchestrator-start`, with trusted execution principals `human_operator`, `manual_operator`, and `orchestrator_start`. The narrow CLI defaults to `human_operator` / `human-ui` / `local_ui`. |
Expand Down Expand Up @@ -284,8 +285,8 @@ skills, automation, and the existing runtime.
```sh
python3 scripts/configure_organization.py status
python3 scripts/configure_organization.py runtime-paths
python3 scripts/configure_organization.py classify --prompt "Review the latest forecast"
AGENT_ORG_MAINTENANCE=1 python3 scripts/configure_organization.py classify --prompt "Repair a hook"
python3 scripts/configure_organization.py classify --prompt "Review the latest forecast" --mode strict --organization-state enabled
python3 scripts/configure_organization.py classify --prompt "Repair a hook" --organization-state maintenance
python3 scripts/configure_organization.py validate-all
python3 scripts/configure_organization.py workflow-selector validate-contracts
python3 scripts/configure_organization.py workflow-frontdoor --help
Expand All @@ -295,7 +296,7 @@ python3 scripts/configure_organization.py workflow-frontdoor --help
|---|---|
| `status` | Print organization settings, role and policy counts, and repository root as JSON. |
| `runtime-paths` | Verify the ITB runtime, workflow selector/frontdoor/server, operator CLI, and registry mirrors. |
| `classify` | Classify a prompt as `fast`, `strict`, or `maintenance`. |
| `classify` | Classify a prompt with optional `--mode {fast,strict}` and the separate `--organization-state {enabled,disabled,maintenance}` control. |
| `validate-all` | Run the offline suites, contract validation, and Python compile check. |
| `workflow-selector` | Validate workflow contracts and perform deterministic selection and activation-envelope operations. |
| `workflow-frontdoor` | Provide the complete host-owned frontdoor and recovery surface. |
Expand Down Expand Up @@ -386,7 +387,7 @@ is added and attested.
### Scoped worker backend

The live scoped-worker backend fails closed until a host operator manually
configures the following assets. Sahai never generates keys or credentials.
configures the following assets. Saihai never generates keys or credentials.

The executor implementation is shipped, but the live `managed_worker` claim is
suppressed. Codex 0.144.1 cannot prove absolute denial of a same-rootfs local
Expand All @@ -407,7 +408,7 @@ worker system.
|---|---|
| `SAIHAI_SCOPED_EXECUTOR_KEY_FILE` | Capability HMAC key in a regular, non-symlink, `0600` file containing at least 32 bytes. |
| `SAIHAI_SCOPED_WORKTREE_ROOT` | Canonical root from which the host derives the task/run-bound worktree path. |
| `SAIHAI_SCOPED_REPO_ROOT` | Host-owned absolute repository path. Defaults to the Sahai repository root. |
| `SAIHAI_SCOPED_REPO_ROOT` | Host-owned absolute repository path. Defaults to the Saihai repository root. |
| `SAIHAI_SCOPED_CODEX_EXECUTABLE` | Absolute pinned Codex CLI path whose digest is bound into the work order and capability. Group/world-writable binaries are rejected. |
| `SAIHAI_SCOPED_CODEX_HOME` | Dedicated worker runtime/auth root; the main-agent profile is not inherited. |
| `SAIHAI_ENABLE_SCOPED_WORKER_LIVE=1` | Explicit live-execution gate. Without it, only the deterministic fake harness is available. |
Expand Down Expand Up @@ -524,7 +525,7 @@ canonical root loaded from the primary checkout catalog.
| `GET /api/org?session=<id>` | Team role state, active task, and busy count. |
| `GET /api/role?session=<id>&role=<role_id>` | Role metadata, inbox, latest report, and provider evidence. |
| `GET /api/config` | Organization settings and role/policy indexes. |
| `GET /api/decide?prompt=<text>` | `fast`, `strict`, or `maintenance` classification. |
| `GET /api/decide?prompt=<text>` | Decision with a `fast` or `strict` mode and a separate `enabled`, `disabled`, or `maintenance` organization state. |
| `GET /api/workflow-runs?session=<id>&task=<id>&state=<state>` | Thin read-only workflow-run summaries. |
| `GET /api/workflow-run?session=<id>&run=<id>` | Work order, report, provider evidence, and transition metadata. |
| `GET /api/workflow-lock` | Global workflow-lock status for each configured orchestrator root. |
Expand Down
21 changes: 15 additions & 6 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ audit is in

Create the file in the primary checkout, or validate an existing file:

The setup command requires the eight directory options shown below.
`SAIHAI_ROOT`, the ninth required canonical path, defaults to the primary
checkout that contains the catalog; pass `--saihai-root` only to override that
default. Every supplied path must already exist as a readable directory, and
the Agents Vault must also be writable.

```sh
python3 scripts/setup_directory_paths.py \
--agents-vault /absolute/path/to/Agents-Vault \
Expand All @@ -48,8 +54,8 @@ The setup command refuses to overwrite an existing file.

The loader locates the catalog in this order:

1. path supplied by process variable `SAIHAI_DIRECTORY_PATH_ENV` (or legacy `SAHAI_DIRECTORY_PATH_ENV`);
2. `directory-path.env` below process `SAIHAI_ROOT` or legacy `SAHAI_ROOT`;
1. path supplied by process variable `SAIHAI_DIRECTORY_PATH_ENV`;
2. `directory-path.env` below process `SAIHAI_ROOT`;
3. `directory-path.env` in the current Saihai checkout;
4. `directory-path.env` in the primary checkout of a linked Git worktree;
5. no file.
Expand Down Expand Up @@ -79,8 +85,10 @@ values.

Normal Saihai entrypoints fail closed unless all nine canonical directory paths
listed as required below exist and are readable. `AGENTS_VAULT_ROOT` must also
be writable. Bootstrap-only consumers may load the catalog without enforcing
the complete contract so that recovery remains possible.
be writable. The setup command applies the same checks before creating the
catalog and refuses to overwrite an existing file. Bootstrap-only consumers
may load the catalog without enforcing the complete contract so that recovery
remains possible.

## Canonical variables

Expand Down Expand Up @@ -111,6 +119,7 @@ emits value-free deprecation diagnostics.
| `YASU_VAULT_ROOT` | `USER_VAULT_ROOT` |
| `SKILLS_REPO_SKILLS_ROOT` | `SKILLS_ROOT` |
| `DEV_REPO_ROOT` | `DEV_ROOT` |
| `SAHAI_DIRECTORY_PATH_ENV` | `SAIHAI_DIRECTORY_PATH_ENV` |
| `SAHAI_ORCH_STATE_ROOT` | `SAIHAI_ORCH_STATE_ROOT` |
| `SAHAI_ITB_STATE_ROOTS` | `SAIHAI_ITB_STATE_ROOTS` |

Expand All @@ -132,5 +141,5 @@ python3 scripts/setup_directory_paths.py --check
```

To recover from an invalid explicit selector, unset
`SAIHAI_DIRECTORY_PATH_ENV` (and legacy `SAHAI_DIRECTORY_PATH_ENV`) so normal
primary-checkout discovery can resume.
`SAIHAI_DIRECTORY_PATH_ENV` so normal primary-checkout discovery can resume.
Compatibility selector names are listed only in the table above.
Comment on lines 143 to +145

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the legacy selector in recovery steps

When a migrated environment still has SAHAI_DIRECTORY_PATH_ENV set to a bad path, unsetting only SAIHAI_DIRECTORY_PATH_ENV will not recover discovery: directory_paths.resolve_env_file() still treats LEGACY_CATALOG_ENV_KEY as an explicit selector and load_environment() fails before falling back to the checkout catalog. Since this page now documents SAHAI_DIRECTORY_PATH_ENV as a supported compatibility selector, the recovery instruction should tell operators to unset both selector variables.

Useful? React with 👍 / 👎.

Loading