Skip to content

HARP-CORE Specification

Version: 0.2 Draft (Standards-Grade) Status: Draft Specification (Standards Track)


HARP-CORE defines a cryptographically verifiable human authorization layer for autonomous AI agent actions. It standardizes:

  1. Deterministic artifact canonicalization and hashing.
  2. Signed decision tokens binding approvals/denials to exact artifacts.
  3. Mandatory enforcement requirements for a local control boundary (the HARP Enforcer).
  4. Interoperability primitives: schemas, error codes, state machines, and test vectors.

The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are to be interpreted as described in RFC 2119.

  • AI Agent: Produces candidate actions (plans, patches, commands, checkpoints).
  • HARP Enforcer (HE): Mandatory enforcement boundary. Intercepts actions, produces artifacts, requests authorization, verifies Decisions, and gates execution.
  • Mobile Approver (MA): Human-controlled device that reviews artifact content and signs Decisions.
  • Gateway (GW): Optional relay. GW MUST be treated as untrusted for plaintext and MUST be compatible with zero-knowledge routing.
  • Artifact: Deterministic, canonical representation of an action that requires review.
  • artifactHash: SHA-256 digest of an Artifact’s canonical bytes (computed over the signable form defined in Section 5.2).
  • Decision: Signed authorization/denial bound to an artifactHash.
  • DecisionSignable: The Decision object excluding the signature field; canonicalized and signed.
  • Envelope: Transport wrapper for artifacts, decisions, and errors.

HARP-CORE MUST provide:

  • Binding between what was reviewed and what is executed.
  • Replay resistance (nonce + expiry + cache).
  • Deterministic hashing across platforms.
  • Compatibility with untrusted relays (GW).

HARP-CORE does not specify:

  • User interface requirements for review.
  • Transport bindings (HTTP, WebSocket, etc.) beyond the optional Envelope.
  • Key provisioning, rotation, attestation, or revocation (operationally REQUIRED, but out of scope here).

HARP-CORE targets the following threats:

  • T1 Substitution: swap reviewed content with different content before execution.
  • T2 Replay: reuse an old approval to authorize a new or delayed action.
  • T3 Relay compromise: GW observes/modifies/forges traffic.
  • T4 UI deception: MA sees content that differs from what HE will execute.
  • T5 Enforcement bypass: execute action without passing through HE.

Mitigations:

  • Canonicalization + artifactHash binding (T1, T4).
  • Decision signature + expiration + nonce + replay cache (T2).
  • Signature verification always required; E2E encryption recommended (T3).
  • HE gating is mandatory for compliance (T5).

HARP-CORE uses a strict canonical JSON profile:

  1. Serialize using UTF-8.
  2. Object keys MUST be sorted lexicographically (Unicode code points).
  3. Separators MUST be exactly , and : (no whitespace).
  4. No trailing newline.
  5. Strings MUST be valid JSON strings; escape sequences MUST be normalized by the JSON serializer.
  6. Numeric values:
    • Integers are permitted.
    • Floating point values are discouraged due to platform reformatting risk.
    • If non-integer precision is required, represent such values as strings.

Implementations MAY use RFC 8785 (JCS) libraries if they produce identical bytes for all inputs.

If HE detects that it cannot reproduce canonical bytes deterministically for an object, it MUST fail closed and emit HARP_ERR_CANONICALIZATION.


HARP-CORE defines:

  • plan.review
  • task.review
  • patch.review
  • command.review
  • checkpoint.review

artifactHash MUST be computed over the canonical JSON bytes of the Artifact with:

  • artifactHash omitted.
  • All other present fields included.

If optional fields are present (e.g., metadata, extensions), they MUST be included in the signable form.

artifactHashAlg MUST be "SHA-256". artifactHash MUST be 64 lowercase hex characters.

Artifacts MUST include expiresAt. HE MUST treat an Artifact as invalid after expiresAt (subject to configured clock skew; RECOMMENDED 60 seconds).


DecisionSignable is the Decision object excluding signature. The signature input MUST be the canonical JSON bytes of DecisionSignable.

sigAlg MUST be "Ed25519" in v0.2.

The signature MUST be the raw 64-byte Ed25519 signature encoded as base64url without padding.

HE MUST validate:

  1. Signature verifies over DecisionSignable canonical bytes.
  2. Decision expiresAt not exceeded (accounting for skew).
  3. Decision artifactHash equals locally computed artifactHash.
  4. Replay protection checks pass (Section 7).
  5. Scope constraints pass (Section 7).

If any check fails, HE MUST deny execution.


  • once: Decision is single-use for (requestId, artifactHash).
  • timebox: Decision permits execution until expiresAt for the specific artifactHash; HE MUST still prevent multi-use unless explicitly allowed by policy.
  • session: Decision applies to a session boundary. In v0.2, session binding MUST be expressed via an extension field (e.g., policyHints.sessionId). If not present, HE MUST reject with HARP_ERR_SCOPE.

HE MUST maintain a replay cache that records used tuples:

  • (requestId, artifactHash)
  • (nonce, signerKeyId)
  • optionally additional context

Minimum retention MUST be at least until Decision expiration + skew. RECOMMENDED: at least 10 minutes minimum window even for shorter expirations.


An Envelope MAY be used to transport messages. When used, it MUST conform to harp-core-envelope.schema.json.

When emitting errors, implementations MUST include:

  • code (string)
  • message (string)
  • retryable (boolean)
  • optional details (object)
  • HARP_ERR_CANONICALIZATION
  • HARP_ERR_HASH_MISMATCH
  • HARP_ERR_SIGNATURE_INVALID
  • HARP_ERR_EXPIRED
  • HARP_ERR_REPLAY
  • HARP_ERR_SCOPE
  • HARP_ERR_POLICY_DENY
  • HARP_ERR_TRANSPORT
  • HARP_ERR_UNSUPPORTED

Per Artifact requestId, HE MUST implement:

States:

  • CREATED
  • AWAITING_DECISION
  • APPROVED
  • DENIED
  • EXPIRED
  • EXECUTED

Transitions:

  • CREATED -> AWAITING_DECISION (artifact submitted)
  • AWAITING_DECISION -> APPROVED (valid allow Decision)
  • AWAITING_DECISION -> DENIED (valid deny Decision)
  • AWAITING_DECISION -> EXPIRED (artifact expires)
  • APPROVED -> EXECUTED (action executed once per scope rules)
  • APPROVED -> EXPIRED (Decision expires before execution)

HE MUST NOT execute in any state except APPROVED.


  • HE compromise can bypass gating. Implementations SHOULD harden HE (code signing, least privilege, OS key store).
  • MA compromise permits unauthorized approvals; operational key rotation and device revocation are REQUIRED.
  • GW is untrusted; signatures MUST be verified even when E2E encryption is used.
  • Canonicalization bugs are fatal; implementers MUST run the provided test vectors.

  • harp-core-artifact.schema.json
  • harp-core-decision.schema.json
  • harp-core-envelope.schema.json

See HARP_CORE_Test_Vectors_v0_2.md.


Appendix A: Implementation Guidance (Non-Normative)

Section titled “Appendix A: Implementation Guidance (Non-Normative)”
  • Prefer ULID for requestId/sessionId for traceability.
  • Keep repoRef opaque (avoid leaking repo URLs to GW).
  • Use monotonic clocks where possible for expiry evaluation.