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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

---

## [Unreleased]

### Added
- **`am export-aat` / `am verify-aat`** (and `to_aat`, `export_aat`, `verify_aat`): export a
ledger in the record format of the IETF Internet-Draft
`draft-sharif-agent-audit-trail-11` (2026-11-21). The draft is an individual submission,
not a standard; only -11 is targeted and the revision is written into each record.
Includes an RFC 8785 (JCS) canonicaliser for the §6.1 `prev_hash` chain. A ledger whose
native chain fails verification is refused. AAT fields action-mirror does not record
(principal, agent_version, trust_level, outcome) are filled with documented defaults;
see the README section for every limitation.

### Fixed
- README said "21 tests"; the suite had grown past that. The count is no longer hard-coded.

## [0.4.0] — 2026-08-25

### Changed
Expand Down
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Third member of the mirror family — same DNA, new domain:
| Tool | Audits | Question |
|---|---|---|
| 🪞 [measure-mirror](https://github.com/mirror-stack/measure-mirror) | AI evaluation claims | Is the **claim** honest? |
| 🔎 [provenance-mirror](https://github.com/mirror-stack/provenance-mirror) | Content authenticity | Is the **origin** proven? |
| 🔎 [provenance-mirror](https://github.com/mirror-stack/provenance-mirror) | Provenance signals | What origin hints are present? (not authenticated) |
| 🪪 **action-mirror** (you are here) | Agent behaviour | **Who did what, provably?** |
| 👁 [mirror-witness](https://github.com/mirror-stack/mirror-witness) | Cross-operator witness board | Who else **witnessed** it? |

Expand Down Expand Up @@ -134,6 +134,7 @@ am --ledger jebi.jsonl verify # my chain
am --ledger seara.jsonl witness jebi.jsonl --name jebi # pin peer head
am --ledger seara.jsonl verify-peer jebi.jsonl --name jebi # check peer
am cross seara.jsonl jebi.jsonl --names seara jebi # mutual pin
am --ledger jebi.jsonl export-aat --out jebi.aat.jsonl # IETF AAT draft -11
```

Demo (3-agent family, attack included): `PYTHONPATH=. python examples/demo_family.py`
Expand All @@ -153,8 +154,47 @@ Demo (3-agent family, attack included): `PYTHONPATH=. python examples/demo_famil
| `family_verify` | [Finding] | verify the whole family |
| `verify_signatures` | [Finding] | verify the optional signed-identity layer |

| `to_aat` / `export_aat` / `verify_aat` | list / int / [Finding] | IETF AAT draft -11 export (see below) |

See the **[full Guide](docs/GUIDE.md)** for each function's signature and verdicts.

## Export to the IETF Agent Audit Trail format (draft)

`am export-aat` writes the ledger as JSON Lines in the record format of
**[draft-sharif-agent-audit-trail-11](https://datatracker.ietf.org/doc/html/draft-sharif-agent-audit-trail-11)**
(2026-11-21). That is an individual Internet-Draft, not an IETF standard; it has changed
between revisions and may change again. The exporter targets **-11 only**, and writes the
revision into every record (`action_detail.export_profile.draft`).

```bash
am --ledger jebi.jsonl export-aat --out jebi.aat.jsonl \
--principal-type human --principal-id urn:user:operator --agent-version 1.0.0
am verify-aat jebi.aat.jsonl # fields, enums and the §6.1 prev_hash chain
```

What you get: the §3.1 REQUIRED fields, `prev_hash = hex(SHA-256(JCS(previous record)))`
(RFC 8785), `null` on the genesis record, and the original action-mirror entry preserved
under `action_detail.action_mirror` so the export can be checked against the native ledger.
A ledger whose native chain fails `am verify` is **refused**, because re-chaining it would
produce a valid-looking AAT chain over tampered content.

What it does not do:
- **No new evidence.** The export is derived from the native ledger; anyone holding that
ledger can regenerate it byte for byte.
- **Fields action-mirror does not record are filled with stated defaults**: `principal`
(the agent itself, self-asserted), `agent_version` `0.0.0`, `trust_level` `L0`,
`record_phase` `post_execution`, and `outcome` `success` unless `payload.exit` is an
integer. Here `success` means "recorded", not "verified to have succeeded".
- `record_id` / `session_id` are UUIDv4-formatted but derived from seals (so exports are
reproducible), not random.
- Native actions become `tool_call` (`tool_name` = the action string); witness entries
become `decision`. No other AAT action types are inferred.
- The optional Ed25519 `sig` signs the native seal, so it is **not** emitted as an AAT
`signature`. `verify-aat` does not check signatures, trust-level rules or §8 session
records, and cannot detect removal of the last record.
- The JCS implementation is tested against RFC 8785's number and key-ordering rules in
`tests/test_aat.py`, not against an external conformance suite.

---

## Signed identity (optional) — making the *who* as hard as the *what*
Expand Down Expand Up @@ -226,7 +266,7 @@ them up deliberately, not by default.)

What's solid today: chain-sealed action records, content-hash attestation,
position-pinned mutual witness with truncation/replacement detection —
21 tests, all passing, zero dependencies.
tested in CI on Linux and Windows, zero dependencies.

---

Expand Down
36 changes: 35 additions & 1 deletion README_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ am --ledger jebi.jsonl verify # 내 체인
am --ledger seara.jsonl witness jebi.jsonl --name jebi # 동료 head 핀
am --ledger seara.jsonl verify-peer jebi.jsonl --name jebi # 동료 검사
am cross seara.jsonl jebi.jsonl --names seara jebi # 상호 핀
am --ledger jebi.jsonl export-aat --out jebi.aat.jsonl # IETF AAT 초안 -11
```

데모 (3-에이전트 가족, 공격 포함): `PYTHONPATH=. python examples/demo_family.py`
Expand All @@ -138,11 +139,44 @@ am cross seara.jsonl jebi.jsonl --names seara jebi # 상호 핀
| `family_round` | list | 전원이 전원을 핀 |
| `family_verify` | [Finding] | 가족 전체 검증 |
| `verify_signatures` | [Finding] | 선택적 서명-신원 레이어 검증 |
| `to_aat` / `export_aat` / `verify_aat` | list / int / [Finding] | IETF AAT 초안 -11 내보내기 (아래 참조) |

각 함수의 시그니처·판정은 **[완전 가이드](docs/GUIDE_KO.md)** 참조.

---

## IETF Agent Audit Trail 형식으로 내보내기 (초안)

`am export-aat`는 원장을
**[draft-sharif-agent-audit-trail-11](https://datatracker.ietf.org/doc/html/draft-sharif-agent-audit-trail-11)**
(2026-11-21)의 레코드 형식(JSON Lines)으로 씁니다. 이 문서는 개인 제출 인터넷 초안이고
IETF 표준이 아닙니다. 판마다 바뀌어 왔고 앞으로도 바뀔 수 있습니다. 내보내기는 **-11판만**
기준으로 하며, 각 레코드의 `action_detail.export_profile.draft`에 판 번호를 기록합니다.

```bash
am --ledger jebi.jsonl export-aat --out jebi.aat.jsonl \
--principal-type human --principal-id urn:user:operator --agent-version 1.0.0
am verify-aat jebi.aat.jsonl # 필드, 열거값, §6.1 prev_hash 체인 확인
```

들어가는 것: §3.1 필수 필드, `prev_hash = hex(SHA-256(JCS(직전 레코드)))`(RFC 8785),
첫 레코드의 `null`, 그리고 `action_detail.action_mirror` 아래 원래 action-mirror 엔트리
(원장과 대조용). 원장 체인이 `am verify`에서 실패하면 내보내기를 **거부**합니다.
변조된 내용 위에 멀쩡해 보이는 AAT 체인을 새로 만들게 되기 때문입니다.

하지 않는 것:
- **새 증거를 만들지 않습니다.** 원장에서 파생된 것이라, 원장을 가진 사람은 똑같이 다시 만들 수 있습니다.
- action-mirror가 기록하지 않는 필드는 **명시된 기본값**으로 채웁니다: `principal`(에이전트 자신, 자기 주장),
`agent_version` `0.0.0`, `trust_level` `L0`, `record_phase` `post_execution`, `outcome`은
`payload.exit`이 정수일 때만 계산하고 아니면 `success`. 여기서 `success`는 "기록됨"이지 "성공이 검증됨"이 아닙니다.
- `record_id`/`session_id`는 UUIDv4 형식이지만 봉인값에서 파생합니다(재현 가능). 무작위가 아닙니다.
- 원래 행동은 `tool_call`(`tool_name` = 행동 문자열), 증인 엔트리는 `decision`이 됩니다. 다른 AAT 유형은 추론하지 않습니다.
- 선택 기능인 Ed25519 `sig`는 원장 봉인값에 대한 서명이라 AAT `signature`로 **내보내지 않습니다**.
`verify-aat`는 서명, 신뢰 수준 규칙, §8 세션 레코드를 검사하지 않고, 마지막 레코드 삭제는 탐지하지 못합니다.
- JCS 구현은 `tests/test_aat.py`에서 RFC 8785의 숫자·키 정렬 규칙으로 시험했고, 외부 적합성 테스트 모음으로는 시험하지 않았습니다.

---

## 서명 신원 (선택) — *누구*를 *무엇*만큼 단단하게

기본적으로 `agent` 필드는 **자기선언 라벨**입니다: 체인은 *엔트리*가 안 바뀌었음을 증명할 뿐,
Expand Down Expand Up @@ -182,7 +216,7 @@ am verify-sig # 모든 서명 엔
무방비. 자주 핀하세요.

오늘 견고한 것: 체인봉인 행동 기록, 내용해시 입증, 위치고정 상호증인 +
절단/교체 탐지 — 21 테스트 통과, zero-dep.
절단/교체 탐지 — Linux·Windows CI에서 테스트, zero-dep.

---

Expand Down
3 changes: 2 additions & 1 deletion actmirror/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
witness_peer, verify_peer, cross_witness, family_round, family_verify,
report, Finding,
)
from .aat import to_aat, export_aat, verify_aat

__all__ = [
"record", "history", "attest", "verify_chain", "verify_signatures",
"witness_peer", "verify_peer", "cross_witness", "family_round", "family_verify",
"report", "Finding",
"report", "Finding", "to_aat", "export_aat", "verify_aat",
]
__version__ = "0.4.0"
Loading
Loading