Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
da0d879
Phase 10: add provider-neutral adapter contract
EmergentMonk Sep 29, 2026
fb1e977
Phase 10: add generic HTTP adapter
EmergentMonk Sep 29, 2026
a2091ed
Phase 10: add local process adapter
EmergentMonk Sep 29, 2026
bba900f
Phase 10: export generic adapter interface
EmergentMonk Sep 29, 2026
ebaa150
Phase 10: test generic HTTP and process adapters
EmergentMonk Sep 29, 2026
d1dcf4e
Phase 10: add generic adapter CI lane
EmergentMonk Sep 29, 2026
b60f78b
Document Phase 10 generic adapter contract
EmergentMonk Sep 29, 2026
1ef5f8a
Mark Phase 10 generic adapters implemented
EmergentMonk Sep 29, 2026
b2871d4
Document Phase 10 generic adapters
EmergentMonk Sep 29, 2026
479d8cb
Architecture: define Phase 10 generic adapter boundary
EmergentMonk Sep 29, 2026
f0b27a0
Phase 10: preserve capture classification and custody semantics
EmergentMonk Sep 29, 2026
aca9d4a
Phase 10: harden HTTP evidence boundary
EmergentMonk Sep 29, 2026
6dd381a
Phase 10: classify process descriptors conservatively
EmergentMonk Sep 29, 2026
d3a1d7f
Phase 10: classify synthetic completion events as derived
EmergentMonk Sep 29, 2026
1b7e62c
Phase 10: export role-neutral adapter media type
EmergentMonk Sep 29, 2026
6afd173
Phase 10: test conservative classifications and role-neutral bytes
EmergentMonk Sep 29, 2026
9d301df
Document Phase 10 evidence classifications
EmergentMonk Sep 29, 2026
d37ee94
Phase 10: make HTTP framing headers adapter-controlled
EmergentMonk Sep 29, 2026
10bef33
Phase 10: test HTTP framing header ownership
EmergentMonk Sep 29, 2026
c53146f
Document adapter-controlled HTTP framing
EmergentMonk Sep 29, 2026
f3d948b
Clarify Phase 10 descriptor classification
EmergentMonk Sep 29, 2026
ab6e21c
Phase 10: label incomplete HTTP bodies as prefixes
EmergentMonk Sep 29, 2026
895916a
Phase 10: test truncated HTTP prefix semantics
EmergentMonk Sep 29, 2026
4e86378
Phase 10: detect short Content-Length responses
EmergentMonk Sep 29, 2026
0dc6337
Phase 10: use prefix label for all incomplete responses
EmergentMonk Sep 29, 2026
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
40 changes: 40 additions & 0 deletions .github/workflows/adapters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: adapters

on:
push:
paths:
- "provenance_adapters/**"
- "provenance_core/**"
- "provenance_store/**"
- "provenance_custody/**"
- "provenance_verify/**"
- "tests/test_generic_adapters.py"
- "ADAPTERS.md"
- "ROADMAP.md"
- ".github/workflows/adapters.yml"
pull_request:
paths:
- "provenance_adapters/**"
- "provenance_core/**"
- "provenance_store/**"
- "provenance_custody/**"
- "provenance_verify/**"
- "tests/test_generic_adapters.py"
- "ADAPTERS.md"
- "ROADMAP.md"
- ".github/workflows/adapters.yml"

permissions:
contents: read

jobs:
adapters:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Phase 10 generic adapter tests
run: python -m unittest discover -s tests -p 'test_generic_adapters.py' -v
190 changes: 190 additions & 0 deletions ADAPTERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# PROVENANCE Phase 10 — Generic Adapter Interface

Phase 10 defines a provider-neutral adapter boundary without moving provider semantics into `provenance-core`.

~~~text
MODULE=provenance-adapters
CONTRACT=provider-neutral
CORE_SCHEMA_CHANGES=NONE
REFERENCE_ADAPTERS=generic-http,local-process
~~~

## Contract

Every Phase 10 adapter declares an `AdapterContract`:

~~~text
adapter_id
source_kind
observation_boundary
extension_namespace
~~~

The shared evidence translator accepts:

~~~text
input captures
output captures
declared metadata
extensions
failure state
~~~

and emits ordinary Phase 1 core records:

~~~text
ArtifactRecord
EventEnvelope
Relationship
CollectionStatus
~~~

Adapters are not permitted to add provider-specific fields to the universal event schema.

## Evidence classification

Exact payload bytes directly visible at the adapter boundary are emitted through `OBSERVED` events. Synthetic invocation/request descriptors are retained conservatively as `DECLARED` evidence, while operation-level completion summaries are `DERIVED`.

Examples:

~~~text
HTTP request body
HTTP response body
process stdin
process stdout
process stderr
~~~

Request/invocation descriptors and adapter/provider metadata are stored as retained artifacts referenced by `DECLARED` events.

This is intentionally conservative. A provider field does not become independently observed truth merely because an adapter can parse it.

Adapter-specific metadata lives under an explicit extension namespace such as:

~~~text
provenance.adapter.http
provenance.adapter.process
~~~

Extensions remain artifact content. They do not modify core schema semantics.

The reference adapters use one role-neutral `application/octet-stream` artifact media type for retained adapter bytes. Request/response/stdin/stdout roles live in events, which prevents identical bytes from being rebound to conflicting artifact metadata merely because their transport role differs.

## Generic HTTP adapter

`GenericHTTPAdapter` supports ordinary HTTP/HTTPS request-response observation.

It records:

~~~text
request descriptor
request body
response body or observed response prefix
HTTP status as declared adapter metadata
failure collection status when applicable
~~~

Redirects are not followed.

HTTP header values are runtime-only and are deliberately not retained as evidence. This prevents API keys, cookies, and authorization material from becoming ordinary evidence payloads merely because they were needed for transport.

`Content-Type`, `Content-Length`, `Host`, and `Transfer-Encoding` are adapter-controlled rather than caller-overridable, keeping request framing consistent with the recorded URL/body/media-type inputs.

Header names are retained in the request descriptor.

The full target URL is retained in the request descriptor. Operators should therefore keep credentials out of URLs and query strings and use runtime headers instead.

The adapter does not claim observation of:

~~~text
provider-internal model execution
remote infrastructure
hidden prompts
hidden model state
chain-of-thought
actual hardware execution
~~~

## Local process adapter

`ProcessAdapter` executes an argv vector directly with:

~~~text
shell = false
~~~

It records:

~~~text
argv descriptor
stdin
stdout
stderr
exit status as declared adapter metadata
~~~

The inherited environment is deliberately not retained.

Do not place credentials in argv if they should not become evidence.

The adapter does not claim observation of:

~~~text
child-internal control flow
kernel scheduling
library internals
hidden external side effects
~~~

## Failure reporting

Transport failures, HTTP error statuses, timeouts, launch failures, non-zero exits, truncated responses, and configured capture-limit failures produce an `AdapterObservation` whose completion event has:

~~~text
collection_status = COLLECTION_FAILED
~~~

The raised adapter exception carries that observation so the caller can still persist and independently verify the failure evidence.

Failure evidence is not silently discarded because the operation itself failed.

## Persistence

`persist_observation()` composes the existing modules:

~~~text
AdapterObservation
↓
LocalEvidenceStore
↓
LocalCustodyLedger
↓
finalize()
↓
independent verification
~~~

It does not define a new store or verifier.

The same persistence path accepts observations from both reference adapters.

## Exit-gate demonstration

Phase 10 tests execute two structurally different systems:

~~~text
local HTTP server
local child process
~~~

Both emit evidence through the same provider-neutral contract and the existing core schema.

The test then persists both observations into one store and verifies the resulting bundle and custody chain without provider-specific changes to `provenance-core`.

## CI

~~~bash
python3 -m unittest discover -s tests -p 'test_generic_adapters.py' -v
~~~

GitHub Actions runs the same lane in `.github/workflows/adapters.yml`.
46 changes: 46 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,52 @@ Ollama's OpenAI-compatible endpoints are intentionally not used to redefine Phas

---

# 17A. Generic Adapter Interface

Phase 10 adds a provider-neutral adapter contract without changing the universal evidence schema.

The reference contract declares:

```text
adapter identity
source kind
observation boundary
extension namespace
```

Adapter-specific execution produces directly captured payload artifacts plus conservatively DECLARED request/invocation descriptors and ordinary `EventEnvelope` values. Transport/provider metadata is retained as a separate DECLARED artifact rather than adding fields to `EventCore`.

The first two executable reference adapters are intentionally structurally different:

```text
GenericHTTPAdapter
request descriptor + request body
response body / observed prefix
HTTP transport boundary

ProcessAdapter
argv descriptor + stdin
stdout + stderr
direct child-process boundary
```

Both flow through the same `build_observation()` and `persist_observation()` path.

Credentials are outside the ordinary evidence path unless the operator explicitly places them in captured content:

```text
HTTP header values = runtime-only
inherited process environment = runtime-only
```

HTTP target URLs and process argv are evidence-bearing inputs. Operators must therefore avoid putting secrets in URLs/query strings or argv when those values should not be retained.

Failure does not erase observation. Failed HTTP/process operations return a persistable observation whose completion event is `COLLECTION_FAILED`.

See `ADAPTERS.md`.

---

# 18. Ollama CI Contract

The initial real-model lane uses a GitHub Actions matrix with separate clean runners. Each matrix job starts its own Ollama server and pulls one small reference model.
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ See `UI.md` for the read-only, gap-visibility, timeline, graph, and verification

---

## Generic adapter interface

Phase 10 adds one provider-neutral evidence translation contract plus two executable reference adapters:

```text
GenericHTTPAdapter → HTTP/HTTPS request-response boundaries
ProcessAdapter → local argv/stdin/stdout/stderr boundaries
```

Both emit the existing core evidence schema and can be persisted through the same store/custody/verifier path. Transport/provider metadata remains a DECLARED artifact under an explicit adapter extension namespace rather than changing `provenance-core`.

HTTP authorization/header values and inherited process environments are intentionally not retained as ordinary evidence payloads.

See `ADAPTERS.md` for the contract, failure semantics, credential boundary, and CI demonstration.

---

## Why PROVENANCE Exists

Modern AI systems rarely perform a single isolated operation.
Expand Down Expand Up @@ -749,6 +766,8 @@ See [CLI.md](CLI.md) for the Phase 8 Rust terminal CLI/TUI contract.

See [UI.md](UI.md) for the Phase 9 read-only localhost HTTP viewer contract.

See [ADAPTERS.md](ADAPTERS.md) for the Phase 10 provider-neutral generic adapter contract.

---

# Implementation Roadmap
Expand Down Expand Up @@ -778,7 +797,7 @@ Phase 8 Rust terminal CLI/TUI
↓
Phase 9 read-only localhost HTTP viewer
↓
additional adapters
Phase 10 generic HTTP + local process adapters
```

The full roadmap, exit gates, CI progression, and later trust/privacy/distributed phases are defined in [ROADMAP.md](ROADMAP.md).
Expand Down Expand Up @@ -865,7 +884,7 @@ A dedicated Ollama Actions lane launches independent small-model instances on cl

The stdio MCP interface and the Rust terminal CLI/TUI are now implemented. The CLI exposes record, inspect, verify, finalize, export, and a keyboard-first slash-command palette while delegating evidence semantics and independent verification to the existing modules. MCP and CLI share one hardened operational working-state journal so acknowledged pending evidence cannot silently diverge between interfaces.

The local pure-HTML/CSS/JS viewer and generic/provider adapters remain later roadmap phases.
The local pure-HTML/CSS/JS viewer and the Phase 10 generic HTTP/process adapter interface are now implemented. Provider-specific adapters remain optional later work and must stay behind the same provider-neutral boundary.

Interfaces and compatibility guarantees should still be considered unstable until explicitly versioned and released.

Expand Down
30 changes: 30 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,12 @@ Deleting the UI changes no evidence identity and no verification outcome.

# Phase 10 — Generic Adapter Interface

## Status

```text
IMPLEMENTED
```

## Goal

Make adapters easy to build without letting them redefine the core.
Expand Down Expand Up @@ -1081,10 +1087,34 @@ Adapters should be developed only when a real integration or test case exists.

Do not create empty provider modules for completeness.

## Reference implementation

Phase 10 defines a provider-neutral `AdapterContract`, shared capture/translation records, and one persistence path that composes the existing store, custody, and verifier modules.

The first two additional executable adapters are deliberately structurally different:

```text
GenericHTTPAdapter
→ ordinary HTTP/HTTPS request-response boundary

ProcessAdapter
→ local argv/stdin/stdout/stderr process boundary
```

Both emit ordinary core `ArtifactRecord` and `EventEnvelope` values. Provider- or transport-specific metadata remains a retained DECLARED artifact under an explicit extension namespace rather than changing `provenance-core`.

Failure observations remain persistable and use `COLLECTION_FAILED` instead of disappearing when the underlying operation fails.

HTTP credential-bearing header values and inherited process environments are runtime-only and are not retained as ordinary evidence payloads.

See `ADAPTERS.md`.

## Exit Gate

At least two structurally different providers/systems can emit evidence into the same core schema without provider-specific changes to core semantics.

The Phase 10 executed test uses a local HTTP server and a local child process, persists both observations through the same store/custody path, and independently verifies the resulting evidence.

---

# Phase 11 — Exportable Evidence Bundles
Expand Down
Loading
Loading