protocol
KLIS-0: The Klock Protocol Foundations
The foundations of deterministic conflict resolution between N-agents.
Overview
KLIS (Klock Object Intent Specification) is a protocol for deterministic conflict resolution between N-agents. It provides a mechanism for agents to declare symbolic intent over shared resources before execution, ensuring safety in multi-agent environments.
Normative vs Non-Normative Reference
To ensure standard compliance, KLIS strictly separates the core protocol from implementation choices.
Normative (REQUIRED)
Implementations MUST adhere to these elements to be KLIS-compliant:
- SPO Triple Structure: Intents must follow the definition in KLIS-1.
- Predicate Vocabulary: The core conflict matrix logic defined in KLIS-2.
- Verdicts: The four verdicts (GRANTED, WAIT, DIE, PAUSED) and their exact semantics.
- Wait-Die Guarantees: The monotonic ordering based on timestamps must be respected without exception.
- Lease Lifecycle: The acquisition, heartbeat, and expiry mechanics defined in KLIS-3.
Non-Normative (Reference Only)
These elements are implementation details and NOT part of the binding specification:
- CLI Wrappers: How the agent invokes the kernel is up to the environment.
- Intent Sniffing: Automatic inference of intent (via static analysis, AST parsing, or FS watchers) is a tooling choice.
- Language Bindings: Node.js, Python, or Go adapters are convenience layers.
- Storage Backend: The Kernel can use Redis, SQLite, or Postgres as long as consistency guarantees are met.
Definitions
The following terms are used throughout the KLIS specifications with these normative meanings:
- Agent: An autonomous process that issues Intents to the Klock Kernel.
- Intent: A declaration consisting of one or more SPO triples with a unique timestamp.
- Resource: An abstract identifier representing a shared object.
- Older / Younger: A total ordering derived from monotonic intent timestamps.
- Priority Escalation: Defined strictly as Forced Abort + Restart. An agent cannot increase its priority (change its timestamp) while holding or waiting for a lease. It must die and be reborn.
- Kernel: The pure deterministic execution engine defined by this specification.
- Lease: A time-bound grant of authority over a specific resource.
- Verdict: The binding decision returned by the Kernel for a given Intent.
- StateDigest: A normative, serializable snapshot of the Kernel's view of an agent, used to bridge temporal gaps in execution.
Protocol Invariants
These invariants define the correctness of the protocol and MUST NOT be violated by any implementation:
- Determinism: Given identical inputs (StateSnapshot + IntentManifest), the Kernel MUST produce identical verdicts.
- Safety: Two conflicting intents MUST NOT be granted simultaneously.
- Liveness: The system MUST guarantee that at least one intent can progress (guaranteed by Wait-Die).
- Non-Bypassability: No agent may modify a resource without holding a corresponding lease.
- Monotonicity (Immutability): Intent priority/timestamp MUST NOT change during a lease attempt attempt. Any priority change requires re-submission (new timestamp).
- Continuity (Resurrection): An implementation MUST support the rehydration of an agent's governance context (Leases and Priority) after a process restart. A "Resurrected" agent is semantically identical to its predecessor.
Authority Boundaries
The Klock Kernel has authority over:
- Intent registration
- Conflict evaluation
- Lease lifecycle
- Verdict issuance
The Klock Kernel has NO authority over:
- Agent internal state
- Execution correctness
- Business logic validation
- Resource semantics beyond declared identifiers
Goals
- Deterministic Conflict Resolution: Given a set of intents and a state snapshot, the protocol must produce the same verdict every time.
- Symbolic Intent: Intents are declared as Subject-Predicate-Object (SPO) triples, allowing for fine-grained conflict detection.
- No-IO Kernel: The core protocol logic must be pure, enabling portability across runtimes (WASM, Rust, Go, etc.).
- Deadlock Prevention: Strict adherence to the "Wait-Die" protocol to ensure the system remains live.
Non-Goals (Boundaries)
- Agent Communication: Klock is NOT a message bus. It does not help agents "talk" to each other or exchange data.
- Code Generation: Klock does not care about the implementation details of the code being executed. It only cares about the resources touched.
- Version Control: Klock is NOT a replacement for Git. It is a real-time lock manager for intents, not a history of changes.
- Resource Discovery: Klock does not find resources for agents. Agents must know what resources they intend to use.
- Execution Management: Klock decides if an agent can proceed, but it does not run the agent's code or monitor its execution beyond heartbeats.
- Rollback & Recursion: KLIS detects and reports scope violations. Remediation (rollback, patch reversion, human intervention) is the responsibility of the execution environment, not the Kernel.
The Verdicts
The Kernel can return one of four verdicts for any Intent:
- GRANTED: The agent may proceed with the execution.
- WAIT: The resource is held by an older agent; the requesting agent must wait.
- DIE: The resource is held by an older agent, and the requesting agent is younger; the requesting agent must abort and restart (with a new timestamp).
- PAUSED: Execution is temporarily suspended (e.g., for user intervention or manual override).