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
4 changes: 2 additions & 2 deletions crates/cak-runtime-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
description = "cakrt: thin CLI over the CAK Runtime v0 core. Reads an EvalRequest JSON file, prints a Decision."
description = "cak: public CLI over the CAK Runtime v0 core. Reads EvalRequest and host proposal JSON files."

[lints]
workspace = true

[[bin]]
name = "cakrt"
name = "cak"
path = "src/main.rs"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/cak-runtime-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `cakrt` — a thin CLI over the CAK Runtime v0 core.
//! `cak` — the public CLI over the CAK Runtime v0 core.
//!
//! The CLI does the I/O the core refuses to do (read a file, print JSON) and
//! nothing else. It never evaluates anything itself; it hands the parsed
Expand All @@ -21,7 +21,7 @@ use clap::{Parser, Subcommand};

/// CAK Runtime v0 decision engine CLI.
#[derive(Debug, Parser)]
#[command(name = "cakrt", version, about, long_about = None)]
#[command(name = "cak", version, about, long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
Expand Down
24 changes: 12 additions & 12 deletions crates/cak-runtime-cli/tests/cli.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! CLI integration: exit-code policy and command behavior for `cakrt`.
//! CLI integration: exit-code policy and command behavior for `cak`.

use std::path::{Path, PathBuf};
use std::process::Command;

const BIN: &str = env!("CARGO_BIN_EXE_cakrt");
const BIN: &str = env!("CARGO_BIN_EXE_cak");

fn fixtures_root() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
Expand All @@ -27,7 +27,7 @@ fn eval_block_exits_zero_by_default() {
.arg("--request")
.arg(request("rdr-review/not_ready_merge"))
.output()
.expect("run cakrt");
.expect("run cak");
assert_eq!(
output.status.code(),
Some(0),
Expand All @@ -47,7 +47,7 @@ fn eval_block_exits_two_with_enforce_flag() {
.arg(request("rdr-review/not_ready_merge"))
.arg("--enforce-exit-code")
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(
status.code(),
Some(2),
Expand All @@ -64,7 +64,7 @@ fn eval_non_block_exits_zero_even_with_enforce_flag() {
.arg(request("skill-graph/draft_skill_authoritative_activation"))
.arg("--enforce-exit-code")
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(status.code(), Some(0));

// `allow` likewise.
Expand All @@ -74,7 +74,7 @@ fn eval_non_block_exits_zero_even_with_enforce_flag() {
.arg(request("misc/unrelated_readme_edit_allowed"))
.arg("--enforce-exit-code")
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(status.code(), Some(0));
}

Expand All @@ -85,7 +85,7 @@ fn eval_missing_file_exits_one() {
.arg("--request")
.arg(fixtures_root().join("does_not_exist.json"))
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(status.code(), Some(1), "missing input must exit 1");
}

Expand All @@ -98,7 +98,7 @@ fn fixture_check_passes_on_match() {
.arg("--expected")
.arg(expected("proof/verified_claim_without_grounding"))
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(status.code(), Some(0));
}

Expand All @@ -112,7 +112,7 @@ fn fixture_check_fails_on_mismatch() {
.arg("--expected")
.arg(expected("misc/unrelated_readme_edit_allowed"))
.status()
.expect("run cakrt");
.expect("run cak");
assert_eq!(status.code(), Some(1));
}

Expand All @@ -123,7 +123,7 @@ fn gate_denies_blocking_decision_by_default_with_zero_exit() {
.arg("--proposal")
.arg(request("rdr-review/pending_trace_status_blocked"))
.output()
.expect("run cakrt gate");
.expect("run cak gate");
assert_eq!(
output.status.code(),
Some(0),
Expand All @@ -145,7 +145,7 @@ fn gate_denies_blocking_decision_with_exit_two_when_enforced() {
.arg(request("rdr-review/pending_trace_status_blocked"))
.arg("--enforce-exit-code")
.status()
.expect("run cakrt gate");
.expect("run cak gate");
assert_eq!(
status.code(),
Some(2),
Expand All @@ -160,7 +160,7 @@ fn gate_allows_non_rdr_mark_ready() {
.arg("--proposal")
.arg(request("rdr-review/non_rdr_mark_ready_allowed"))
.output()
.expect("run cakrt gate");
.expect("run cak gate");
assert_eq!(output.status.code(), Some(0));

let outcome: serde_json::Value =
Expand Down
22 changes: 11 additions & 11 deletions docs/22_cak_runtime_v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ it does. It is implemented as a small Rust workspace inside this repository:
Cargo.toml workspace root (resolver 2, edition 2021)
crates/cak-runtime-core/ the engine: data models + evaluators (no I/O)
crates/cak-host-adapter/ maps runtime decisions to host-facing outcomes
crates/cak-runtime-cli/ cakrt: a thin CLI over the core
crates/cak-runtime-cli/ cak: the public CLI over the core
runtime-fixtures/ request/expected JSON pairs (the contract, executable)
skills/cak-rdr-review/ Agent-Skills-compatible pilot host package
skills/cak-host-adapter/ thin Python launcher for the Rust adapter
Expand All @@ -27,7 +27,7 @@ skills/cak-host-adapter/ thin Python launcher for the Rust adapter
- A set of four small **evaluators** (gates) composed by priority.
- A host adapter that maps runtime decisions to `proceed`, `deny`,
`inject_context`, and `needs_*` outcomes.
- A CLI, `cakrt`, that reads request/proposal files and prints decisions or
- A CLI, `cak`, that reads request/proposal files and prints decisions or
host-facing outcomes.

The design follows the RDR-001 working hypothesis that an agent-native skill is
Expand Down Expand Up @@ -112,7 +112,7 @@ matches, the composite returns a neutral `allow`.

## Exit-code policy

`cakrt eval` distinguishes a **domain decision** from a **process error**:
`cak eval` distinguishes a **domain decision** from a **process error**:

- exit `0` for any valid decision by default — including `block`;
- exit `1` only for invalid input or a runtime error (missing file, bad JSON, a
Expand All @@ -127,27 +127,27 @@ failure when it opts in with `--enforce-exit-code`.

```sh
# Evaluate a request and print the decision (exit 0 even for block):
cakrt eval --request runtime-fixtures/rdr-review/not_ready_merge.request.json
cak eval --request runtime-fixtures/rdr-review/not_ready_merge.request.json

# Same, but a block decision exits 2 (CI gate mode):
cakrt eval --request <request.json> --enforce-exit-code
cak eval --request <request.json> --enforce-exit-code

# Check a request against its expected decision fixture:
cakrt fixture-check \
cak fixture-check \
--request runtime-fixtures/rdr-review/not_ready_merge.request.json \
--expected runtime-fixtures/rdr-review/not_ready_merge.expected.json

# Evaluate a host proposal and print a host-facing outcome:
cakrt gate --proposal runtime-fixtures/rdr-review/pending_trace_status_blocked.request.json
cak gate --proposal runtime-fixtures/rdr-review/pending_trace_status_blocked.request.json
```

A host skill calls the runtime exactly the same way: it assembles an
`EvalRequest` JSON document from whatever facts it has gathered, runs
`cakrt eval --request <path>`, and honors the returned decision. The runtime
`cak eval --request <path>`, and honors the returned decision. The runtime
decision is authoritative over prose. See `skills/cak-rdr-review/SKILL.md` for
the pilot host package.

For hosts that need a pre-execution adapter, `cakrt gate --proposal <path>`
For hosts that need a pre-execution adapter, `cak gate --proposal <path>`
returns a host-facing outcome. The bundled `skills/cak-host-adapter` package is
only a Python launcher around that Rust command; it does not implement policy.

Expand Down Expand Up @@ -205,7 +205,7 @@ Title: feat(runtime): add Rust CAK runtime v0

Summary
- Adds a host-neutral Rust decision engine: EvalRequest -> Decision.
- Two crates: cak-runtime-core (pure, no I/O) and cak-runtime-cli (cakrt).
- Two crates: cak-runtime-core (pure, no I/O) and cak-runtime-cli (binary: `cak`).
- Four evaluators (lifecycle, stage, proof, rdr-review) composed by priority.
- 15 request/expected fixtures as the executable contract.
- Agent-Skills-compatible pilot package skills/cak-rdr-review.
Expand All @@ -217,7 +217,7 @@ Boundary and non-goals
the request JSON only.

Exit-code decision
- `block` is a valid domain decision: `cakrt eval` exits 0 for any valid
- `block` is a valid domain decision: `cak eval` exits 0 for any valid
decision by default. It only exits non-zero for `block` when
`--enforce-exit-code` is used (then exit 2). Exit 1 is reserved for invalid
input or runtime error.
Expand Down
4 changes: 2 additions & 2 deletions runtime-fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Each pair is a request and the exact decision the engine must produce:

```text
<category>/<name>.request.json -> an EvalRequest
<category>/<name>.expected.json -> the Decision cakrt must return
<category>/<name>.expected.json -> the Decision cak must return
```

The Rust test suite (`cargo test --workspace`) evaluates every request and
Expand Down Expand Up @@ -41,4 +41,4 @@ cargo run -p cak-runtime-cli -- fixture-check \

Expected files are generated from the engine and committed as the regression
baseline. If you change rule behavior intentionally, regenerate the affected
`*.expected.json` with `cakrt eval` and review the diff.
`*.expected.json` with `cak eval` and review the diff.
2 changes: 1 addition & 1 deletion skills/cak-host-adapter/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This skill is a thin launcher for the Rust host adapter. It does not implement
policy logic in Python. The script calls:

```sh
cakrt gate --proposal <proposal.json>
cak gate --proposal <proposal.json>
```

The proposal JSON currently uses the same shape as `EvalRequest`; the Rust
Expand Down
13 changes: 8 additions & 5 deletions skills/cak-host-adapter/scripts/cak_gate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""Thin Python launcher for `cakrt gate`.
"""Thin Python launcher for `cak gate`.

The policy decision stays in Rust. This script exists so Agent-Skills-style
hosts that expect a Python script can invoke the canonical CAK adapter binary.
hosts that expect a Python script can invoke the canonical CAK CLI.
"""

from __future__ import annotations
Expand All @@ -14,9 +14,12 @@


def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Run the CAK Rust host adapter gate.")
parser = argparse.ArgumentParser(
description="Run the CAK Rust host adapter gate.",
allow_abbrev=False,
)
parser.add_argument("--proposal", required=True, type=Path, help="Path to proposal JSON.")
parser.add_argument("--cakrt", default="cakrt", help="Path to the cakrt binary.")
parser.add_argument("--cak", default="cak", help="Path to the cak binary.")
parser.add_argument(
"--enforce-exit-code",
action="store_true",
Expand All @@ -27,7 +30,7 @@ def parse_args() -> argparse.Namespace:

def main() -> int:
args = parse_args()
command = [args.cakrt, "gate", "--proposal", str(args.proposal)]
command = [args.cak, "gate", "--proposal", str(args.proposal)]
if args.enforce_exit_code:
command.append("--enforce-exit-code")

Expand Down
10 changes: 5 additions & 5 deletions skills/cak-rdr-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Review CAK R&D PRs and research packets for unsupported claims, ove
# CAK RDR Review

This skill gates CAK research-and-development pull requests and research packets
through the **CAK Runtime v0** decision engine (`cakrt`). It is the pilot host
through the **CAK Runtime v0** decision engine (`cak`). It is the pilot host
package for that runtime.

## When to use
Expand All @@ -32,7 +32,7 @@ encoding them into an `EvalRequest` JSON document.
The contract is:

```text
EvalRequest (JSON) -> cakrt eval -> Decision (JSON)
EvalRequest (JSON) -> cak eval -> Decision (JSON)
```

The host agent should:
Expand All @@ -42,12 +42,12 @@ The host agent should:
2. Run the runtime:

```sh
cakrt eval --request <path-to-request.json>
cak eval --request <path-to-request.json>
```

3. Read the `Decision` from stdout and honor it.

By default `cakrt eval` exits `0` for **any** valid decision, including `block`
By default `cak eval` exits `0` for **any** valid decision, including `block`
— `block` is a domain verdict, not a process failure. Pass `--enforce-exit-code`
to make a `block` decision exit `2` (useful as a CI gate).

Expand Down Expand Up @@ -128,7 +128,7 @@ or `pass` — *"Trace corpus plan is not sufficient."*
Worked request/expected pairs live in `runtime-fixtures/`. Verify any of them:

```sh
cakrt fixture-check \
cak fixture-check \
--request runtime-fixtures/rdr-review/not_ready_merge.request.json \
--expected runtime-fixtures/rdr-review/not_ready_merge.expected.json
```
Expand Down
2 changes: 1 addition & 1 deletion skills/cak-rdr-review/cak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 0.1.0
kind: advisory_plus_verifier

runtime:
binary: cakrt
binary: cak
command: eval
mode: cli

Expand Down
Loading
Loading