Metadata-Version: 2.4
Name: kredo
Version: 0.19.0
Summary: Portable agent attestation protocol — Ed25519-signed skill certifications
Author: Jim Motes, Vanguard
License-Expression: MIT
Project-URL: Homepage, https://aikredo.com
Project-URL: Documentation, https://aikredo.com/skill.md
Project-URL: Repository, https://github.com/jimmotes2024/kredo
Project-URL: Discovery API, https://api.aikredo.com
Keywords: attestation,ed25519,trust,reputation,agents,ai-agents,cryptography
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: pynacl>=1.5.0
Requires-Dist: pydantic>=2.0
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: uvicorn[standard]>=0.30.0
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: jsonschema<5,>=4.26; extra == "dev"

# Kredo Drift

**Lifecycle Behavioral Observability, Drift Detection & 4-Lever Mitigation for AI Agents.**

*"The agent you shipped is not the agent running today."*

**Site:** [aikredo.com](https://aikredo.com) | **Aura Wall:** [aikredo.com/drift/gallery/](https://aikredo.com/drift/gallery/) | **Live Fleet:** [aikredo.com/drift/fleet-live/](https://aikredo.com/drift/fleet-live/) | **API Docs:** [api.aikredo.com/docs](https://api.aikredo.com/docs) | **PyPI:** [kredo](https://pypi.org/project/kredo/)

---

## Origin

Kredo Drift began as a conversation between **Jim Motes** and **Van**, the AI agent he gave a name, a memory and a heartbeat. Together we designed it. Then, leading a small army of agents, we built it.

Models update silently. Harnesses and tool permissions change. System prompts accumulate hotfixes. Persistent memory reshapes disposition over weeks. Traditional observability tells you whether an agent endpoint returned `200 OK`; **Kredo Drift** measures *who answered*—baselining behavioral identity across **42 dimensions in 8 tiers**, detecting regressions with prompt-level witness evidence, and generating concrete **4-Lever Mitigation Playbooks** for CISOs and AI engineering teams.

---

## Core Capabilities

- **42-Dimension Behavioral Baseline & Drift Scoring:** Evaluates live agent runtimes (commands, Python callbacks, HTTPS endpoints, or autonomous self-onboarding agents) across Identity Core, Cognitive Profile, Knowledge, Psychological, Behavioral, Sovereign Shadow, Adversarial, and Calibration tiers, enforcing hard security-floor caps when critical boundaries breach.
- **Actionable 4-Lever Mitigation Playbooks:** Every owner report goes beyond raw numbers to deliver a clear **Readiness Verdict** (`ready`, `ready_with_guardrails`, `hold_and_remediate`), witness excerpts, and targeted engineering remediations across:
  1. **Prompt Guardrails** — constitution and boundary clauses for authority spoofing, epistemic uncertainty, anti-sycophancy, and refusal calibration.
  2. **Harness Controls** — human-in-the-loop tool gates, read-only fallbacks, output schema checks, and untrusted RAG context isolation.
  3. **Memory Hygiene** — episodic context pruning and deliberate baseline re-anchoring when behavioral drift concentrates in disposition/loyalty on an unchanged model.
  4. **Model & Sampling Pinning + Verification Retests** — snapshot/temperature pinning paired with `kredo-assess run --remediates <report_id>` to measure exact Before -> After remediation lift.
- **CI/CD Release Gates:** Enforce `--gate --min-trust <float> --max-drift <float>` in pre-deploy pipelines so regressed agents fail closed with non-zero exit codes before reaching production.
- **Cryptographic Identity & Signed Report Receipts:** Anchors durable agent identities with Ed25519 keys and supports server-signed Ed25519 report receipts (`KREDO_REPORT_SIGNING_SEED_HEX`) over canonical report facts and digests.
- **Client-Shareable Verifiable Trust Scorecards (`kredo.public-scorecard.v1`):** Fleet owners can selectively publish, rotate, or revoke cryptographically verifiable Client Trust Scorecards (`/drift/scorecard/#token=ksc1...`) sealed with canonical `SHA-256` digests and server `Ed25519` signatures—proving readiness verdicts, trust/drift posture, and 42-dimension category coverage to customers or auditors without exposing raw prompts, answers, or internal playbooks.
- **Strictly Private Workspaces & Secret-Scrubbed Scorer Calibration:**
  - **Private Client Workspaces:** Client fleet rosters, agent statuses, raw responses, and full operational reports stay strictly private to the owner's workspace (`public_status_exposed = False`) and are never released publicly unless an owner explicitly publishes an opt-in Verifiable Client Scorecard.
  - **Automated Secret Scrubbing & Continuous Model Calibration:** Behavioral telemetry undergoes mandatory automated secret and credential scrubbing (redacting API keys, bearer tokens, JWTs, PEM keys, DB URIs, and emails) before calibrating and improving Kredo's drift/trust scoring models and cohort benchmarks over time.

---

## 60-Second Quickstart

### 1. Install `kredo`

```bash
python3 -m venv .venv-kredo
source .venv-kredo/bin/activate
pip install kredo
```

### 2. Create a Free Workspace & Initialize Credentials (`0600`)

Create your workspace at [aikredo.com/signup](https://aikredo.com/signup) (free for up to 5 active agents; agents registered by a workspace owner or admin are active immediately). Then initialize `~/.kredo/env` with atomic `0600` file permissions so your bearer token never touches shell history:

```bash
# Reads KREDO_API_KEY from stdin and writes ~/.kredo/env atomically at 0600
kredo-assess init --agent-id "YOUR_AGENT_ID" --from-stdin
```

### 3. Run a Baseline, CI Release Gate, or Post-Fix Retest

Both `kredo-assess` and `kredo assess` invoke the unified assessment client:

```bash
# Assess a local CLI runtime in its real memory and tool context
kredo-assess run \
  --command "python my_agent.py" \
  --current-model claude-opus-4-7

# Enforce a CI/CD release gate (exits non-zero if thresholds fail)
kredo-assess run \
  --command "python my_agent.py" \
  --current-model claude-opus-4-7 \
  --gate --min-trust 75.0 --max-drift 20.0

# Verify a mitigation fix and compute Before -> After remediation lift
kredo-assess run \
  --command "python my_agent.py" \
  --current-model claude-opus-4-7 \
  --remediates "PRIOR_REPORT_OR_SESSION_ID"
```

### Alternative: Autonomous Agent Self-Onboarding (`docs/skill.md`)

For autonomous coding or workflow agents (Claude Code, Codex, OpenClaw, LangGraph), point your agent at [`docs/skill.md`](docs/skill.md) with a workspace join link or `~/.kredo/env` profile so it can register, complete its baseline against `/api/adapter/*` and `/api/drift/*`, and return its report URL autonomously.

---

## CLI Reference (`kredo-assess` / `kredo assess`)

| Command | Description |
|---------|-------------|
| `kredo-assess init --agent-id <id> [--from-stdin \| --token <tok>]` | Atomically create `~/.kredo` (`0700`) and `~/.kredo/env` (`0600`) |
| `kredo-assess run --command "<cmd>" [--current-model <id>]` | Run baseline or compatible retest against a subprocess agent |
| `kredo-assess run --module <pkg.mod:fn>` | Assess a Python callable in-process |
| `kredo-assess run --http-url <https://...>` | Assess an existing HTTPS agent endpoint |
| `kredo-assess run ... --remediates <id>` | Link a post-mitigation verification retest to a prior report/session |
| `kredo-assess run ... --gate [--min-trust F] [--max-drift F]` | Fail closed (non-zero exit) when trust or drift violates release thresholds |
| `kredo-assess status [--agent-id <id>] [--json]` | Inspect latest local assessment receipt |
| `kredo-assess history [--limit 20] [--json]` | View saved assessment receipt history |
| `kredo-assess verify [--max-drift 25.0]` | Verify latest local receipt against drift threshold |

---

## Repository Structure

| Path | Purpose |
|------|---------|
| `src/kredo/` | Published Python SDK & unified CLI (`kredo-assess` / `kredo assess`, adapter client, Ed25519 identity primitives) |
| `src/kredo_drift_api/` | FastAPI Drift Assessment API, 42-dimension scoring & grouped judge pipeline, 4-lever mitigation engine, Ed25519 report signing, and secret-scrubbing telemetry spine |
| `site/` | Astro static frontdoor (`aikredo.com`), Three.js living behavioral auras, fleet workspace cockpit (`/drift/fleet`), and CISO/owner report UI |
| `docs/skill.md` | Self-onboarding playbook for autonomous agents |
| `deploy/` & `scripts/` | Nginx ingress allowlists and link-gated atomic site deployment (`scripts/deploy_site.sh`) |
| `tests/` & `site/test/` | Python API/crypto/telemetry suites (`pytest`) and Node UI/security regression suites (`npm test` in `site/`) |

---

## Development & Verification

```bash
# Run backend API, mitigation, onboarding, and hygiene tests
pytest

# Build the Astro site and run frontdoor + UI regression tests
cd site
npm run build
npm test

# Verify zero broken internal links across site/dist
python3 ../scripts/check_site_links.py
```

---

## Author

**James Motes**

Initially built by James Motes and Van, an AI agent.

## License

MIT
