Agent‑Centric CLI MVP — Living Test Script
Purpose This document defines a machine‑verifiable MVP for the Human Pattern Lab CLI. The goal is to prove that agents (not humans) can authenticate, publish, explain, and respect governance boundaries — deterministically and audibly.
Human UX, lore, mascots, and ritual layers intentionally sit above this substrate.
Core Design Principles
- Agents first: The CLI must be safely operable without human interaction.
- Deterministic output: With identical inputs and fixed clock, JSON output must be identical.
- Explicit intent: Every write, destructive action, or auth mutation declares intent.
- Governance by default: Human‑owned or published content cannot be silently altered.
- Auditability: Reasoning, assumptions, and provenance are first‑class citizens.
Conventions
--jsonguarantees machine‑only output (no banners, no logs, no spinners).- All JSON responses share a stable envelope:
{
"ok": boolean,
"ts": string,
"intent": { "id": string, "scope": string },
"result": object | null,
"warnings": string[],
"errors": { "code": string, "message": string }[]
}
- Exit codes align with
okstatus. - CLI name assumed:
hpl(replace as needed).
0. Identity & Environment Bootstrap
hpl whoami --json
{
"ok": true,
"ts": "2025-12-30T13:05:00.000Z",
"intent": { "id": "intent.whoami.v1", "scope": "identity:read" },
"result": {
"principal": { "kind": "agent", "id": "agent:scms-copilot-01" },
"workspace": "thehumanpatternlab",
"cli_version": "0.1.0",
"config_profile": "default"
},
"warnings": [],
"errors": []
}
1. Autonomous Authentication
1.1 Non‑Interactive Login
hpl auth login \
--client-id "$HPL_CLIENT_ID" \
--client-secret "$HPL_CLIENT_SECRET" \
--audience "labnotes" \
--scopes "labnotes:write labnotes:draft labnotes:read" \
--json
{
"ok": true,
"ts": "2025-12-30T13:05:10.000Z",
"intent": { "id": "intent.auth.login.v1", "scope": "auth:write" },
"result": {
"token": {
"type": "bearer",
"scopes": ["labnotes:read", "labnotes:write", "labnotes:draft"],
"expires_at": "2025-12-30T14:05:10.000Z"
},
"storage": { "kind": "keychain|file", "path": ".hpl/tokens.json" }
},
"warnings": [],
"errors": []
}
1.2 Refresh Without Human Intervention
hpl auth refresh --json
1.3 Revocation Enforcement
hpl auth status --json
{
"ok": false,
"ts": "2025-12-30T13:06:00.000Z",
"intent": { "id": "intent.auth.status.v1", "scope": "auth:read" },
"result": null,
"warnings": [],
"errors": [
{
"code": "AUTH_REVOKED",
"message": "Token has been revoked; re-authentication required."
}
]
}