diff --git a/packages/core/README.md b/packages/core/README.md index 6d0982e..aeba5ea 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -377,6 +377,38 @@ to create an initial immutable context bag before opening a scope. Prefer the `scope.context` after a scope starts. The implementation does not provide a mutable service container or process-global registry. +### Declared Agent Tool Authority + +`runAgent()` can evaluate a capability declared by an `agent.tool()` call +against `allowedCapabilities` and `deniedCapabilities`. A denied declared +capability emits `agent:tool_denied` and throws `AgentCapabilityError` before +the tool body starts. + +```ts +import { runAgent } from "@workit/core/ai"; + +await runAgent(async (agent) => { + await agent.tool( + "read_repository", + undefined, + async () => readRepository(), + { capability: "repo:read" }, + ); +}, { + authority: { allowedCapabilities: ["repo:read"] }, +}); +``` + +The 1.0 contract is opt-in per tool call: when `AgentToolOptions.capability` is +omitted, the authority policy is not evaluated and the tool is admitted. An +allowlist therefore does not make unannotated tools fail closed. Applications +that require fail-closed behavior must ensure every governed tool declares a +capability before it reaches `agent.tool()`. + +This contract is a cooperative application policy. It is not authentication, +human approval, rollback, or an operating-system sandbox. A tool body can still +perform behavior broader than the capability string it declares. + ### Candidate Selection > Available since `0.6.0`. Its release evidence includes a redacted external- diff --git a/packages/core/evidence/claims.json b/packages/core/evidence/claims.json index e20af5d..9ea7b0d 100644 --- a/packages/core/evidence/claims.json +++ b/packages/core/evidence/claims.json @@ -169,7 +169,7 @@ }, { "id": "CORR-006", - "title": "agent authority denies undeclared capability before tool execution", + "title": "agent authority denies a declared capability outside the allowlist before tool execution", "class": "correctness", "status": "proven", "proof": "tests/evidence/correctness/agent-authority.mjs", diff --git a/packages/core/tests/evidence/correctness/agent-authority.mjs b/packages/core/tests/evidence/correctness/agent-authority.mjs index ad5f0d3..5cb46e8 100644 --- a/packages/core/tests/evidence/correctness/agent-authority.mjs +++ b/packages/core/tests/evidence/correctness/agent-authority.mjs @@ -12,7 +12,7 @@ const suite = createSuite("correctness"); await suite.proof( "CORR-006", - "agent authority denies undeclared capability before tool execution", + "agent authority denies a declared capability outside the allowlist before tool execution", "denied declared tool capability emits agent:tool_denied and the tool body is never called", async () => { let called = false;