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
12 changes: 7 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ tests. The approved scope is the [Support Desk enhancement plan](https://github.
`0.1.0` packages completed manual maintainer bootstrap with exact-byte
postflight on 2026-11-07, without OIDC provenance. All four `0.1.1` packages
subsequently completed verified trusted publication; retain the
[release receipt](docs/BOOTSTRAP.md#verified-knowledge-base-release).
Source `0.1.2` is the SD-03 atomic draft/source candidate and still requires
its own review, current-head gates, trusted publication, and strict verification.
[historical release receipt](docs/BOOTSTRAP.md#historical-verified-011-release).
All four `0.1.2` packages have since completed verified trusted publication
for SD-03 atomic draft/source authoring. Source `0.1.3` is the synchronized,
unpublished optional human-reviewed evidence-report candidate and still
requires its own review, current-head gates, trusted publication, and strict verification.
Real-host acceptance remains separate.
- Never implement a database, authorization role model, identity/session/token
system, audit log, request limiter, or durable scheduler here. Compose the
Expand Down Expand Up @@ -110,7 +112,7 @@ only from the downloaded artifact. Preflight all four registry versions before
any publish, and recover only by accepting byte-identical existing artifacts.
See [release operations](docs/RELEASING.md) and the
[publication ledger](docs/BOOTSTRAP.md) for the completed manual bootstrap
and verified trusted `0.1.1` receipts. All five KB/Agent Access trusted publishers
and verified KB `0.1.2` and Agent Access `0.1.1` receipts. All five KB/Agent Access trusted publishers
have been configured through the CLI; that configuration does not prove a
trusted publish. Recheck ownership, signer, tag, approval environment, direct
publishing, and 2FA/token restrictions for the release. OIDC publishing receives only verified prepared
Expand All @@ -126,7 +128,7 @@ packed KB candidate artifacts and the official SDK in a fresh temporary consumer
with lifecycle scripts disabled. It accepts no source-producer fallback.
Historical source-fixture evidence is not evidence for changed proof code;
current-head Node 22/24 gates must execute the registry composition. The KB
`0.1.2` candidate's own review, trusted publication, and strict registry
`0.1.3` candidate's own review, trusted publication, and strict registry
verification remain open. Host acceptance remains open before activation.
Keep actual existing-login/Admin-consent and every requested client/mode proof
open in P-00 and PG-01/RG-01 until both hosts record them before activation.
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Hosts own their users, storage, authorization policy, interfaces, and deployment
Knowledge Base owns collection policy, immutable article revisions, validation,
and exact publication approval. It requires no GitHub connection or AI provider.

> Development status as of 2026-11-07: KB-01 through KB-03 provide contracts, pure domain
> Development status as of 2026-11-08: KB-01 through KB-03 provide contracts, pure domain
> transitions, authorized application/persistence, and bounded retrieval/repair.
> [Merged KB-04 source](https://github.com/pegma-dev/knowledge-base/pull/5) adds
> the optional five-operation HTTP/MCP adapter and authenticated protocol proof.
Expand All @@ -15,10 +15,14 @@ and exact publication approval. It requires no GitHub connection or AI provider.
> supplies exact-artifact tooling. Both are merged. All four `0.1.0` packages
> completed manual bootstrap with exact-byte postflight on 2026-11-07, without
> OIDC provenance. All four `0.1.1` packages subsequently completed
> [verified trusted publication](docs/BOOTSTRAP.md#verified-knowledge-base-release).
> Source `0.1.2` is the SD-03 atomic draft/source candidate; its own review,
> current-head gates, trusted release, and strict registry/provenance verification
> remain required. Actual two-host existing-login/client acceptance remains open.
> [verified trusted publication](docs/BOOTSTRAP.md#historical-verified-011-release).
> All four `0.1.2` packages have since completed
> [verified trusted publication](docs/BOOTSTRAP.md#verified-knowledge-base-release)
> for SD-03 atomic draft/source authoring. Synchronized `0.1.3` is the
> **unpublished source candidate** for optional human-reviewed
> [evidence reports](docs/EVIDENCE_REPORTS.md); its review, current-head CI,
Comment thread
FlyOverCoderKY marked this conversation as resolved.
Resolved
> trusted publication and strict consumer verification remain pending.
> Actual two-host existing-login/client acceptance remains open.
> Host activation remains separately gated; this repository supplies no hosted KB.

| Package | Scope |
Expand Down Expand Up @@ -143,10 +147,11 @@ Merging source does not publish a package. The
[maintainer bootstrap ledger](docs/BOOTSTRAP.md) records the completed manual
`0.1.0` uploads and exact-byte postflight. All five KB/Agent Access trusted
publishers are configured through the CLI. Agent Access's verified trusted
`0.1.1` release and the four-package KB trusted `0.1.1` release are complete;
their exact receipts remain in the ledger. All four KB packages and Agent Access
have `latest: 0.1.1` and `bootstrap: 0.1.0`. Source `0.1.2` remains a candidate
for a separately reviewed trusted release. Neither registry publication nor
`0.1.1` release and the four-package KB trusted `0.1.2` release are complete;
their exact receipts remain in the ledger. All four KB packages have
`latest: 0.1.2`; Agent Access has `latest: 0.1.1`; all retain historical
`bootstrap: 0.1.0`. Source `0.1.3` remains unpublished and needs its own review,
current-head CI, trusted release and strict consumer verification. Neither registry publication nor
synthetic proof satisfies real host acceptance or approves activation.

Built in the open by RetireGolden, LLC.
111 changes: 104 additions & 7 deletions docs/AGENT_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ an MCP adapter, and a Web Request/Response adapter. Both transports invoke the
existing `KnowledgeBaseApplication`; neither introduces
an authorization engine or another article lifecycle. The KB `0.1.0` packages
completed manual bootstrap without OIDC provenance. All four `0.1.1` packages
have since completed [verified trusted publication](BOOTSTRAP.md#verified-knowledge-base-release).
Source `0.1.2` remains a candidate with its own review, gates, and verified
trusted release pending.
have since completed verified trusted publication. The current verified KB
release is [`0.1.2`](BOOTSTRAP.md#current-verified-012-release).
Optional report mode is new unpublished `0.1.3` candidate source, with its own
review, gates and verified trusted release pending.
Agent Access's verified public `0.1.1` producer prerequisite is closed; see the
[release receipt](BOOTSTRAP.md#verified-agent-access-prerequisite). Passing
synthetic transport tests does not establish live host login, protected staging
execution, KB trusted publication, or host readiness.

## Trusted host composition

Create `createKnowledgeAgentDispatcher({ application, resource, limits? })` once.
Create `createKnowledgeAgentDispatcher({ application, resource, reports?, limits? })`.
For every call and retry the host must authenticate the credential, validate its
exact audience/resource and client, and resolve current authorization. Supply
`{ access, scopes, clientId, resource }` as a trusted `KnowledgeAgentIdentity`,
Expand Down Expand Up @@ -68,7 +69,8 @@ validation requirements. There are no collection, private-evidence read,
provenance, review, publication, retirement, retrieval, or administration tools
in this initial transport surface.

Inputs use the following bounded subset of the public application contracts:
Legacy inputs use the following bounded subset of the public application
contracts; configured report-mode variants are described below:

- `getDraft`: `{ articleId }`.
- `getValidationRequirements`: `{ collectionId, kind }`.
Expand Down Expand Up @@ -96,6 +98,100 @@ anything. The existing trusted evidence verifier must authenticate and bind the
opaque receipt; missing verification fails closed. The transport fetches no
artifact URL and executes no guide step.

## Optional native-client report mode

The unpublished `0.1.3` source adds an optional `reports` port:
`Pick<KnowledgeEvidenceReports, "report" | "ledger" | "status">`. A host can
compose the shared [human-report factory](EVIDENCE_REPORTS.md) behind this port.
It adds no tool or scope. The same MCP connection advertises extended strict
input schemas/descriptions for the existing requirements and evidence tools;
HTTP accepts the same versioned envelopes. Clients cannot enable the mode
through a request flag. When `reports` is omitted, legacy tool schemas,
accepted inputs and result shapes remain unchanged; extension fields reject.

The public types are `KnowledgeAgentReportRequirementsInput`,
`KnowledgeAgentReportRequirementsResult`, `KnowledgeAgentReportSubmissionInput`,
`KnowledgeAgentPendingReport`, `KnowledgeAgentReportEnvelope`, and
`KnowledgeAgentReportSuccess`. Both report variants require the effective
`draftRead` **and** `evidenceSubmit` permissions. This does not change the
legacy requirements variant's `draftWrite`-or-`evidenceSubmit` rule.

For report-aware `getValidationRequirements`, input is strictly
`{ collectionId, kind, articleId, reportLookup?: { ledgerEpoch, reportId } }`.
The current draft must match the supplied collection/kind. The result adds
`reportLedger: { ledgerEpoch, status: "active" | "resetting" }` to the normal
requirements. Supplying `reportLookup` also returns the submitting owner's
body-free `reportStatus: { ledgerEpoch, reportId, receipt, reportGeneration,
status: "pending" | "confirmed" | "rejected" }`. No report body, reviewer,
private accepted evidence or trusted-attester registry is exposed. An epoch
mismatch conflicts; another submitter's report is not found.
The input variant selects the output schema: a report-aware result must contain
valid bounded report metadata. Malformed extended port results are unavailable,
not silently reduced to legacy requirements. Configured legacy inputs still
receive the legacy result. Polling rechecks the report DTO after its other
awaited reads; observed receipt, generation or status drift conflicts, and a
fresh poll obtains a new point-in-time view. It is not a global atomic snapshot.

For report submission, the existing `submitEvidence` tool accepts strictly
`{ commandId, correlationId, expectedGeneration, articleId, evidence,
ledgerEpoch, report: { summary, details } }`, with **no `receipt` field**.
`evidence` remains the whole original `EvidenceSubmission`; `summary` is at
most 1,000 characters and `details` at most 16,000, within the existing complete
request bounds. New admission checks the exact current article generation and
ledger epoch. The result is
`{ kind: "pending-human-review", ledgerEpoch, reportId, receipt,
reportGeneration }`, with the receipt's **JSON-encoded string** bounded to 512
UTF-8 bytes, including its surrounding quotes and any escapes. This also applies
to custom host report ports: a receipt of 512 ASCII letters encodes to 514
bytes and is rejected; quotes and backslashes require further escaping. The
complete acknowledgement still fits the existing
2,048-byte minimum response budget; that budget is unchanged. This records a
private report only: it is not `{ value, replayed }`, does not accept KB evidence,
and does not change the article generation. Keep that distinction in clients.

A human uses separately authorized staff services to inspect the private
report and record a decision. A current authorized Admin may review their own
agent's report; no two-person rule is enforced. The agent polls through the
report-aware requirements input. After first confirmation, it uses the same
original opaque report receipt and exact evidence in the legacy `submitEvidence`
input, with the current article generation. Only that call performs actual KB
qualification. Current runner/result/build/governance, reviewer trust, exact
revision and freshness checks still apply; `confirmed` is not accepted evidence.
Explicit reassessment rotates the receipt cycle; poll for its current receipt
and obtain a new human confirmation before submitting it.

The optional port is trusted host composition, not a credential verifier. Bind
each `report`, `ledger` and `status` call to the same authenticated request/grant
and recheck that grant's identity, scope/resource restrictions and revocation
before and after awaited work. Preserve the dispatcher-supplied restricted
context; a freshly resolved owner/Admin context must not replace it. The host
must fence current grant changes during these awaits as well as authenticate
the initial transport request. The shared ledger's current-principal checks
do not independently authenticate a host grant.

Report writes and article reads/commits are separate. A later fence failure
can withhold a response after a report was queued; conflict or unavailability
does not prove rollback. Retry an uncertain report command with the same ID
and exact input under fresh authority, including the original
`expectedGeneration`. The dispatcher forwards it as the shared service's
optional `expectedArticleGeneration`, bound into the command fingerprint when
present. Exact replay lookup precedes the new-admission generation check: a
retry can recover its historical acknowledgement at a stable newer article
generation, while changing the expected generation on the same command
conflicts. New commands with a wrong generation are not admitted. Custom report
ports must preserve this generation-binding/replay contract as well as the DTO
shape. The observed before/after draft fence still applies, so a change during
recovery can withhold that response again. A recovered acknowledgement does not
establish current review status or receipt validity; poll owner-only status
before using it. Report epoch/generation conflicts and resetting ledgers map to
`conflict`; report bounds/capacity to `capacity`;
missing grants to `forbidden`; unconfirmed or altered receipts fail actual
evidence qualification with `prerequisite`. No agent report-listing, human
decision, reset/drain, private-evidence read or publication tool is added.
The [public types](../packages/mcp/src/types.ts) and
[source protocol cases](../tests/agent-reports.test.ts) cover this optional mode;
actual native-client/host acceptance remains separate.

## HTTP composition

`createKnowledgeAgentHttp({ dispatcher, apiUrl, resource,
Expand Down Expand Up @@ -165,9 +261,10 @@ and `createdAt`, plus bounded state flags. They exclude evidence, provenance,
review records, and attestation artifacts. Validation requirements expose only
collection/governance generation, policy reference, expected staging build,
and current checks; trusted runner/attester registries remain private.
Mutations return the existing `{ value, replayed }` acknowledgement with
Article mutations return the existing `{ value, replayed }` acknowledgement with
ID/generation, content revision, state, and content hash. Output schemas
explicitly whitelist these DTO fields.
explicitly whitelist these DTO fields. Configured report queuing instead
returns the distinct `pending-human-review` result described above.

Failures are `{ apiVersion: "1", operation, error: { code, status, message } }`.
Invalid envelopes use `operation: null` rather than reflecting an arbitrary
Expand Down
Loading
Loading