# Agent Action Registry (MVP)

A minimal JSONL log standard + CLI for agent actions. No API costs.

## Why this matters
Every agent needs an audit trail. This gives you a portable, append-only action log
that works across tools.

## Install (local dev)

```bash
python -m venv .venv
source .venv/bin/activate
pip install -e .
```

## Quick Start

```bash
areg init
areg log --user-id demo --action-type purchase --tool browser --target amazon.co.jp \
  --decision require_approval --status pending --reason "over limit" \
  --tags payment,high_risk --metadata '{"amount":5000,"currency":"JPY"}'

areg view --limit 5
areg stats
areg validate
```

## Python SDK

```python
from action_registry import log_event

event_id = log_event(
    user_id="demo",
    action_type="purchase",
    tool="browser",
    target="amazon.co.jp",
    decision="require_approval",
    status="pending",
    reason="over limit",
    tags=["payment", "high_risk"],
    metadata={"amount": 5000, "currency": "JPY"},
)
print(event_id)
```

## Node SDK

```js
import { logEvent } from "./sdk/node/index.js";

const id = logEvent({
  userId: "demo",
  actionType: "purchase",
  tool: "browser",
  target: "amazon.co.jp",
  decision: "require_approval",
  status: "pending",
  reason: "over limit",
  tags: ["payment", "high_risk"],
  metadata: { amount: 5000, currency: "JPY" },
});
console.log(id);
```

## Log Viewer

Open `web/viewer.html` and paste JSONL into the textarea.

## Demo Site

Open `web/index.html`.

## GitHub Action

Use `.github/actions/areg-upload` to upload `.areg/actions.jsonl` as an artifact.
## Spec
See `SPEC.md`.

## Files
- `action_registry/cli.py` CLI implementation
- `action_registry/format.py` spec helpers
- `SPEC.md` log format

## Roadmap (for adoption)
- SDKs (Python/Node)
- Web viewer
- GitHub Action to attach logs to PRs
