<!-- SPDX-License-Identifier: Apache-2.0 -->
**Status:** stable · **Owner:** Developer Relations · **License:** Apache-2.0

# `cocoindex` — KYE adapter for CocoIndex

A thin flow hook around a CocoIndex pipeline that records each transform / index
update as a KYE tool-call inside the §0.3 evidence chain. Wrap your existing flow
function — the flow is unchanged.

```python
from adapter import KyeCocoIndexHook

kye = KyeCocoIndexHook()
kye.on_flow_start("policy_index")
for source in sources:
    kye.on_transform(source.name)      # one tool-call per indexed source
    flow.update(source)
kye.on_flow_complete()
```

- `on_flow_start` → `kye.agent.governance.v1` (the §52 task-start binding).
- `on_transform` → `kye.evidence.tool_call.v1` per transform / index update.
- `on_flow_complete` → `kye.agent.completion.v1` (the task-end ledger).

## Non-competition lock (§0 / §0.30 / §32 — permanent)

KYE **governs** the CocoIndex pipeline as a first-class principal; it does
**NOT** run, replace, or vendor CocoIndex, and it is **not** a data / index
engine. Indexed records are tenant data — keep them tenant-keyed; never cross the
boundary (§0.11). `cocoindex` is a peer dependency, referenced as an integration
point only. The non-competition lock is permanent.

## Reuses the canonical envelope

Same three envelopes as
[`governed-agent`](../../agent-dev-kit-templates/governed-agent/README.md) (§32)
— no new envelope is invented. Reference shapes:
[`public/examples/agent-governance/`](../../../examples/agent-governance/).

## Files

- `src/adapter.py` — the `KyeCocoIndexHook`.
